Google Apps Script



Many are already familiar with Google Docs, Drive, Gmail, Google+, and Google Forms. These and other Google products such as Google Keep, Vault, and Jamboard (a physical, digital board) form G Suite.

G Suite is a collection of different tools for productivity. Most of these tools are free. However, extra features especially suitable for businesses may be purchased by upgrading to an appropriate pricing package. Although G Suite products have several powerful and useful features, Google Apps Script gives developers the ability to develop even more powerful features.

What is Google Apps Script? In the words of Paul McReynolds, Google Apps Script “is a serverless JavaScript runtime for G Suite automation, extension, and integration.” This means you can publish web apps, build add-ons, leverage the power of other services, and perform several other useful functions. Since Google Apps Script is a scripting language based on JavaScript, it is fairly easy to pick up, even for beginners. It runs on the cloud, so you don’t have to go through any rigmarole in setting up a functional development environment.

There are various kinds of scripts you can create, and this is influenced by the function the script will perform.

1. Stand-alone Script
A stand-alone script is not bound to any particular Google Forms or Slides document. Stand-alone Scripts are created via the Google Apps Script site. An alternative way is via Google Drive. From the site, one may run, debug, and deploy the script. More interesting are the deploy options available: deploy as web app, API executable, publish to Chrome store, and deploy as web add-on. The stand-alone script file is saved in Google Drive.

2. Container-bound Scripts
Container-bound scripts are bound to a particular G Suite app file like a Google Docs file. The file the script is bound to is known as the container. A container-bound script can be created by opening the script editor under the Tools menu. This opens up the Google Apps Script console as in the case of stand-alone scripts.

3. Web Apps
You can add a user interface for scripts. Google Apps Scripts allows stand-alone scripts and container-bound scripts to be turned into web apps. Nonetheless, two conditions must be met: the app contains a dotGet(e) or dotPost(e) function and it returns an HTML service HtmlOutput object or a Content service TextOutput object. The script can then be deployed as a web app by selecting that option from the Deploy menu.

First Google Apps Script

To demonstrate how easy it is to create a script, we will build a container-bound script with Google Docs. This script will create a footer for a new document (one without a footer) and display your email in the footer.
Note that your permission will be required to execute the script. Grant the script access to execute the code. You should now see “Document created by ” in the footer section of the page.

 function myFunction() { 
  // get current document
   var doc = DocumentApp.getActiveDocument();
  // set footer text
  doc.addFooter().appendParagraph("Document created by: " + Session.getActiveUser().getEmail());

This only shows a simple function. However, complex and far more useful scripts can be built with Google Apps Script. This reference is the perfect place to start. It provides all the classes and methods needed for each G Suite application, including Docs, Forms, Calendar, Gmail, and Drive.


Google Apps Script provides developers the tools to create super-amazing features. What is even more interesting is that scripts can be easily turned into fully functional web apps. If you use G Suite heavily, you should consider using Google Apps Script to automate the boring stuff.

Bruno is a junior at Ashesi University College studying Computer Science. He is interested in leveraging the power of technology to increase productivity. As a big fan of open source technology, he is currently exploring the possibility of using the Bitcoin Blockchain to fight corruption in government. Bruno is a regular contributor at Fixate IO.


Leave a Comment

Your email address will not be published. Required fields are marked *

Skip to toolbar