{"id":19651771,"url":"https://github.com/tanaikech/syncgooglescriptrun","last_synced_at":"2025-10-20T10:21:27.279Z","repository":{"id":79705794,"uuid":"208203630","full_name":"tanaikech/syncGoogleScriptRun","owner":"tanaikech","description":"This is a Javascript library to use \"google.script.run\" with the synchronous process.","archived":false,"fork":false,"pushed_at":"2021-03-22T06:07:14.000Z","size":5,"stargazers_count":15,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-03T02:03:19.849Z","etag":null,"topics":["dialog","google-apps-script","javascript-library","js-library","sidebar","synchronous","web-apps"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tanaikech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-09-13T05:49:04.000Z","updated_at":"2025-08-23T03:42:45.000Z","dependencies_parsed_at":"2023-05-14T20:15:31.564Z","dependency_job_id":null,"html_url":"https://github.com/tanaikech/syncGoogleScriptRun","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tanaikech/syncGoogleScriptRun","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanaikech%2FsyncGoogleScriptRun","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanaikech%2FsyncGoogleScriptRun/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanaikech%2FsyncGoogleScriptRun/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanaikech%2FsyncGoogleScriptRun/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tanaikech","download_url":"https://codeload.github.com/tanaikech/syncGoogleScriptRun/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanaikech%2FsyncGoogleScriptRun/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280074954,"owners_count":26267458,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-20T02:00:06.978Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dialog","google-apps-script","javascript-library","js-library","sidebar","synchronous","web-apps"],"created_at":"2024-11-11T15:07:57.054Z","updated_at":"2025-10-20T10:21:27.274Z","avatar_url":"https://github.com/tanaikech.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# syncGoogleScriptRun\n\n[![Build Status](https://travis-ci.org/tanaikech/syncGoogleScriptRun.svg?branch=master)](https://travis-ci.org/tanaikech/syncGoogleScriptRun)\n[![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](LICENCE)\n\n\u003ca name=\"top\"\u003e\u003c/a\u003e\n\n# Overview\n\nThis is a Javascript library to use \"google.script.run\" with the synchronous process.\n\n# Description\n\nWhen I create Web Apps, add-on using a side bar and dialog, there is the case that I want to use `google.script.run` with the synchronous process. As you know, [`google.script.run` works with the asynchronous process](https://developers.google.com/apps-script/guides/html/reference/run). So in order to use it as the synchronous process, the script is required to be prepared. I also saw several issues for such situation at Stackoverflow and other sites. I thought that when the script for achieving this was prepared as a library, it might be useful for users. So I created this.\n\n# Install\n\n```html\n\u003cscript src=\"syncGoogleScriptRun.min.js\"\u003e\u003c/script\u003e\n```\n\nOr, using jsdelivr cdn\n\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/gh/tanaikech/syncGoogleScriptRun@master/syncGoogleScriptRun.min.js\"\u003e\u003c/script\u003e\n```\n\n- Of course, you can use this by directly copying and paste the script of [syncGoogleScriptRun.js](https://github.com/tanaikech/syncGoogleScriptRun/blob/master/syncGoogleScriptRun.js) to the script editor.\n\n\u003ca name=\"method\"\u003e\u003c/a\u003e\n\n# Method\n\n| Method                      | Explanation                                                        |\n| :-------------------------- | :----------------------------------------------------------------- |\n| syncGoogleScriptRun(object) | Run a function of Google Apps Script with the synchronous process. |\n\n- `object`: There are 2 properties.\n  - `gasFunction`: Function name of Google Apps Script side.\n  - `arguments`: Arguments for the function.\n\n\u003ca name=\"usage\"\u003e\u003c/a\u003e\n\n# Usage\n\n## Sample script\n\nIn this sample script, the result is returned every 1 second.\n\nWhen you use the following sample script, please copy and paste the following scripts to the container-bound script of Spreadsheet. And run `openDialog()`. By this, a dialog is opened at Spreadsheet. When you clicked the button, you can see the result at the console.\n\n#### HTML side: `index.html`\n\n```HTML\n\u003cinput type=\"button\" value=\"Run script\" onClick=\"run()\"\u003e\n\n\u003cscript src=\"https://cdn.jsdelivr.net/gh/tanaikech/syncGoogleScriptRun@master/syncGoogleScriptRun.min.js\"\u003e\u003c/script\u003e\n\n\u003cscript\u003e\nasync function run() {\n  for (let i = 0; i \u003c 5; i++) {\n\n    const resource = {\n      gasFunction: \"myFunction\", // Function name of Google Apps Script side\n      arguments: i // Arguments for the function\n    };\n    const res = await syncGoogleScriptRun(resource).catch(e =\u003e {throw new Error(e)});\n\n    console.log(res);\n  }\n}\n\u003c/script\u003e\n```\n\n#### Google Apps Script side: `Code.gs`\n\n```javascript\nfunction myFunction(e) {\n  Utilities.sleep(1000);\n  return e;\n}\n\nfunction openDialog() {\n  var html = HtmlService.createHtmlOutputFromFile(\"index\");\n  SpreadsheetApp.getUi().showModalDialog(html, \"sample\");\n}\n```\n\n#### Result\nWhen the button of \"Run script\" is clicked, you can see the following result at the console.\n\n```\n0\n1\n2\n3\n4\n```\n\n---\n\n\u003ca name=\"licence\"\u003e\u003c/a\u003e\n\n# Licence\n\n[MIT](LICENCE)\n\n\u003ca name=\"author\"\u003e\u003c/a\u003e\n\n# Author\n\n[Tanaike](https://tanaikech.github.io/about/)\n\nIf you have any questions and commissions for me, feel free to tell me.\n\n\u003ca name=\"updatehistory\"\u003e\u003c/a\u003e\n\n# Update History\n\n- v1.0.0 (September 13, 2019)\n\n  1. Initial release.\n\n[TOP](#top)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftanaikech%2Fsyncgooglescriptrun","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftanaikech%2Fsyncgooglescriptrun","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftanaikech%2Fsyncgooglescriptrun/lists"}