A spreadsheet that can easily execute functions (called commands) created with Google Apps Script. It also supports long-running scripts.
The original spreadsheet is here.
Related article is here.
And an article about long-running support is here.
This spreadsheet will help you in the following ways.
- it makes your functions manageable and easy to understand.
- it allows you to modify execution parameters and to run the functions easily.
- it allows you to check the execution result log easily.
Open this spreadsheat, click [File]-[Make a copy], and save it to your Google Drive with a name of your choice. (You must be signed in with a Google account.)
Open the new spreadsheet, click [Tools]-[Script editor].
In the Script editor, you can write any function you need. You can write it in any source file you like (or in a new file, of course), but do not edit the group of files starting with gas-terminal
.
Tips
- To output the log to the result area, use the LogUtils class.
- A function can have up to five arguments. (All parameters are of type string)
- If you want to implement a function that runs for a long time, use the LongRun class. (See the bottom of this README)
In the Commands sheet, write the command definition that corresponds to the function you wrote.
In the Terminal sheet, select the command, input parameters, then click the Execute button.
The first time you run it, you will see a dialog asking for permission to run the script. Follow the steps below to allow the script to run.
-
Select your account (Perhaps it will be a different procedure for signing in.)
-
Then click Execute button again.
Don't worry about the word "unsafe". It's a dialog that all of us face when running our personal scripts.๐
- Follow the instructions above to copy the original spreadsheet.
- Open the Script editor, click
Project Settings
, copy theScript ID
. (We'll use it later) - If you have not installed
clasp
yet, installclasp
, following the official page. - Do the command
clasp login
, and login with your account. (If you have not done yet) - Clone this repository, and open the cloned project with your IDE.
- Open
.clasp.json
, and replace thescriptId
with yourScript ID
copied above. - You can make any changes you like to the cloned code.
- Then do the command
clasp push
, and it will replace your copied spreadsheet's Apps Script with your code.
Google Apps Script has the 6 minute execution time limit. This problem is very tricky.
You can solve this problem by using the GAS-Terminal's class LongRun
.
Please see the sample function named LongRunTest
in Code.ts
. You also can run the sample command by select the command named Long-Running Test (Sample)
and can execute it.