mshcruz/GAS-Terminal
A spreadsheet that can easily execute functions (called commands) created with Google apps script.
GAS-Terminal
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.
What is this?
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.
How to use
1. Copy the original spreadsheet (only once).
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.)
2. Open the Script editor
Open the new spreadsheet, click [Tools]-[Script editor].
3. Write your code.
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)
4. Write the definition of the command
In the Commands sheet, write the command definition that corresponds to the function you wrote.
5. Execute the command
In the Terminal sheet, select the command, input parameters, then click the Execute button.
6. Authorize the script to run (only once)
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.๐
7. Click Yes and check the result (as shown at the top of this page).
If you want to modify this tool by using clasp and TypeScript
- 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
claspyet, 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 thescriptIdwith yourScript IDcopied 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.
Support for long-running scripts
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.










