Google Apps Script

Introduction

Google Apps Script is a an application development platform that is integrated with Google’s GSuite, which includes Drive, Gmail, Calendar, and several other services. Apps Script code is written in JavaScript, and through use of Google’s built in libraries, enables powerful automation and analysis of data. This tutorial will focus on applications within Google Sheets in particular. Creating an auto-sort feature will be the example used in this tutorial. Auto-sorting a helpful feature when digitizing multiple records to prevent duplicate entries, as well as speeding up the digitization process.

Familiarity with fundamental programming paradigms such as functions/methods, variables, and control-flow is recommended. Familiarity with JavaScript in particular is not necessary, but may be helpful. If you don’t already have a Google account, you’ll need to create one before starting this tutorial.

Technical Details

Some important technical details further motivate the use of Google Apps Script. Often JavaScript is run client-side; that is, a user’s computer runs JavaScript code from the browser. Apps Script code, however, is run on Google’s cloud servers, making it consistently powerful across any device that makes use of it. Additionally, authored code can be easily “bound” to a Google spreadsheet, making it easy for collaborators to both expand upon and make use of existing code. The steps in this tutorial will result in code that is bounded to the spreadsheet that is created.

Setting up the Environment

We’ll begin by navigating to Google Drive, and will then create a new spreadsheet by going to New > Google Sheets. Now, we’ll bring up the Google Apps Script code editor. From the menu bar at the top select Tools > Script editor. The video that follows will go through the steps necessary to create the auto sort functionality.

Adding Auto-Sort Functionality

A step by step video guide.

Auto Sort in Action

A demonstration video, and an example of additional Apps Script functionality.

Conclusion and Further Resources

This tutorial has just scratched the surface of what is possible with Google Apps Script in Google Sheets, let alone other services within GSuite. I hope you’ve found this tutorial helpful and enjoyed learning about (or more about) Google Apps Script! Here are some useful sites to visit to learn more about Google Apps Script:

Author: John

8 thoughts on “Google Apps Script

  1. I attempted to embed the videos I made onto this page, and while they appeared in the “visual editor” of WordPress, once I published they don’t show up, and all iframe elements are removed when I go back to look at the html. The hyperlinks should work (the latter one as soon as Google finishes “processing” the video).

  2. John, this tutorial is promising and you seem to have a strong understanding of the methods. The second video needs to be shared publicly in order to be viewed, however, so I only got through part of the process. Your video contains good guidance, but it would also be helpful to include a code snippet here, or a link to a finished example, since you type fast and it might be hard for viewers to keep up. Looking forward to finishing when the second video is viewable!

  3. I very much enjoyed this tutorial. I didn’t really know that Google had software to interact with their services from a code-based platform. That’s really cool, and I can think of tons of different ways in which that would be useful from a DH perspective! Unfortunately, I think the second video (the one demonstrating auto-sort in action) requires access to your google account. No idea if that’s possible to fix, as it seems like WordPress is giving you a hard time (classic WordPress).

  4. Great tutorial John! Your tutorial video was easy to follow, but maybe a little fast. Otherwise, a helpful tutorial on a useful tool.

  5. This seems like an extremely powerful tool that I had no idea existed! Who knew you could add your own custom menus and functionality to google sheet? The only thing I would recommend it giving some context of the google sheet before you start coding; you say to open up a google spreadsheet, but what data should we enter into it in order to see the results in action? I think it would be helpful if you showed that setup step in your tutorial as well. Maybe the second video would shed some more light on this, but, like others mentioned, its not publicly viewable at the moment.

  6. Thank you to everyone who commented! I’ll respond more directly later, but I just wanted to share that the hyperlink to the demo video is now working. The original video file I had uploaded was still processing and could not be viewed (and it sounds like the permissions were not working as expected either); on my second attempt, the processing finished within minutes–weird! Thanks for bringing to my attention that things still weren’t quite right!

Leave a Reply

Your email address will not be published.