This is a CLI tool to execute Google Apps Script (GAS) on a terminal.
Will you want to develop GAS on your local PC? Generally, when we develop GAS, we have to login to Google using own browser and develop it on the Script Editor. Recently, I have wanted to have more convenient local-environment for developing GAS. So I created this "ggsrun". The main work is to execute GAS on local terminal and retrieve the results from Google.
Features of "ggsrun" are as follows.
- Develops GAS using your local terminal and text editor which got accustomed to using.Updated! (v1.4.0)
- Executes GAS by giving values to your script.
- Executes GAS made of CoffeeScript.
- Downloads spreadsheet, document and presentation, while executes GAS, simultaneously.
- Downloads files from Google Drive and Uploads files to Google Drive. Updated! (v1.4.1)
- Downloads standalone script and bound script. Updated! (v1.4.0)
- Downloads all files and folders in a specific folder. Updated! (v1.5.2)
- Upload script files and create project as standalone script and container-bound script. Updated! (v1.5.2)
- Update project. Updated! (v1.4.0)
- Retrieve revision files of Google Docs and retrieve versions of projects. Updated! (v1.4.0)
- Rearranges scripts in project. Updated! (v1.4.0)
- Modifies Manifests in project.
Download an executable file of ggsrun from the release page and import to a directory with path.
or
Use go get.
$ go get -u github.com/tanaikech/ggsrun
When you click each link of title, you can see the detail information.
- Setup ggsrun Server (at Google side)
- Create new project and install the server as a library.
- Deploy API executable. Choose "Only myself" as "Who has access to the script"
- Install the server as a library. Script ID of the library is
115-19njNHlbT-NI0hMPDnVO1sdrw2tJKCAJgOTIAPbi_jq3tOo4lVRov
- After installed the library, please push the save button at the script editor. This is very important! By this, the library is completely reflected.
- Get Client ID, Client Secret
- On the Script Editor
- Resources -> Cloud Platform Project
- Click the lower part of "This script is currently associated with project:"
- In "Getting Started", Click "Enable APIs and get credentials like keys".
- On "API APIs&services"
- Click "Credentials" at left side.
- At "Create Credentials", Click OAuth client ID.
- Choose Other
- Input Name (This is a name you want.)
- done
- Download a JSON file with Client ID and Client Secret as
client_secret.json
using download button.
- On the Script Editor
- Enable APIs
- ggsrun uses Google Apps Script API and Drive API. Please enable them at API console. You can directly access them as follows. Project ID can be seen at downloaded
client_secret.json
.https://console.cloud.google.com/apis/library/script.googleapis.com/?project=### project ID ###
- Also here https://script.google.com/home/usersettings has to be enabled. Please turn ON.
https://console.cloud.google.com/apis/api/drive.googleapis.com/?project=### project ID ###
- ggsrun uses Google Apps Script API and Drive API. Please enable them at API console. You can directly access them as follows. Project ID can be seen at downloaded
- Create configure file for ggsrun
- Run
$ ggsrun auth
at the directory withclient_secret.json
.
- Run
- Test Run
- Create a sample script
function main(){return Beacon()}
assample.gs
. - Run
$ ggsrun e2 -s sample.gs -i [Script ID] -j
. Script ID is ID of the project installed the server.
- Create a sample script
Congratulation! You got ggsrun!
Please reauthorize to include a new scope to the access token as follows.
- Confirm whether Google Apps Script API is enabled. You can directly access it as follows. Project ID can be seen at the downloaded
client_secret.json
.https://console.cloud.google.com/apis/library/script.googleapis.com/?project=### project ID ###
- Also here https://script.google.com/home/usersettings has to be enabled. Please turn ON.
- Add a scope of
https://www.googleapis.com/auth/script.projects
toggsrun.cfg
. - Run the following command under the directory with
client_secret.json
andggsrun.cfg
.$ ggsrun auth
Completed!
- Executes GAS and Retrieves Result Values
- Executes GAS with Values and Retrieves Feedbacked Values
- For Debug
- Executes GAS with Values and Downloads File
- Executes Existing Functions on Project
- Download Files
- Downloads all files and folders in a specific folder.
- Upload Files
- Show File List
- Search Files
- Update Project
- Retrieve Revision Files and Versions of Projects
- Rearrange Script in Project
- Modify Manifests
- Authorization for Google Services for your script
- In the case that result is "Script Error on GAS side: Insufficient Permission"
- In the case that result is "message": "Requested entity was not found."
- In the case that result is "Script Error on GAS side: Script has attempted to perform an action that is not allowed when invoked through the Google Apps Script Execution API."
- In the case that result is "Missing ';' before statement."
- About library
If you have any questions and commissions for me, feel free to tell me using e-mail [email protected]
You can see the Update History at here.
If you want to read the detail manual, please check here.