Running GAS is a pain.

Do you like Google Apps Script(GAS)? Me too! 👍
I’ve written a lot of GASs to run system processes and maintain data. Most of them are run by various triggers automatically, but sometimes I need to run some scripts by hand. Then I’ll be reminded that “Running GAS is a pain!” Why? Because there is no smart way to run it and check the results.😓

How do you always execute it?

1. Script Editor
The Script Editor

This may be the most familiar method. You write some code, and click the Run button. That’s all. But it’s a pain to open the Script Editor every time, and you should change the code when you want to change the function’s parameter.

2. Buttons on the spreadsheet
Place buttons

Another way is to place buttons on your spreadsheet and associate your functions with those buttons. This article explains how to do it. This method is a little easier than opening the Script Editor to execute functions. However, as the number of functions increases, the number of buttons also increases, and it tends to get harder to organize. Also, there is still the problem of not being able to change function parameters. Moreover, if you want to know the result of the script execution, you still have to open the Script Editor, unless you have implemented output to a sheet.

Here comes GAS-Terminal !

So I created a tool to make it easier to manage and run GASs. Its name is GAS-Terminal (The name Terminal is because you can switch between various commands (i.e. functions) as if you were in Terminal.) This tool is implemented in Google Sheets, which allows you to execute functions in scripts associated with this sheet.

If you want to know how to use it, please check the GitHub repository !

The following is a running example.

a running example

How is this achieved?

There are some minor points, such as reading the command definition sheet and handling when switching commands, but I simply use the eval function to execute the command.

Here’s the execution logic.

      // Clears the log.
      // Sets the TerminalSheet as logger.
      LogUtils.logger = TerminalSheet.instance;
      // Gets the command definition.
      let commandDef:CommandDefinition = CommandsSheet.instance.findCommand(commandName);
      // Makes the parameter string.
      let params:string[] = TerminalSheet.instance.getParams();
      let paramsStr:string = "";
      if( params.length > 0 ){
          paramsStr = '"' + params.join('","') + '"';
      // Make the function call string.
      let callStr:string = commandDef.funcName + "(" + paramsStr + ")";
      // Executes


I use this tool to run 13 commands in order to maintain my system. How do you always execute GASs? I hope this tool will be useful to you.

I will continue to improve this tool. The next target for now is to incorporate support for longrunning.
If you have any good ideas, please let me know! 😃

No responses yet

Leave a Reply

Your email address will not be published.