Adding Automations to Google Drive with Apps Script

Patrick Della Peruta
  • 7 min read

Google Drive is a wonderful collaboration tool that offers many advanced features and functionality. At times, however, there may be a feature you need that is not included. Fortunately, with just a few lines of code, you can automate repetitive tasks, integrate with external APIs and services, and build custom integrations that will save you time and make your work more efficient

I’ve received all sorts of oddball requests in the 10+ years I have been working as a Google Cloud Architect, many of which are useful little utilities that most Drive users would benefit from. For example, if you have ever worked in a shared folder in Google Drive, you may have noticed that there is no way to get automatic notifications when a colleague adds new files to that folder. Using an apps script, you would be able to set up this function. 

  1. Create a new script by going to Google Drive.
    • Click on the “New” button, then select “Google Apps Script”
    • Give your script a name and open the script editor
  2. Add a trigger that will run the script automatically when a file is added to the folder.
    • Go to the “Edit” menu and select “Current project’s triggers” 
    • Specify that the script should run when a file is added to a folder, and set the specific folder that you want to monitor
  3. In the script editor, you’ll need to write the code that will send the notification. You can use the built-in MailApp class to send an email notification

Create Same Set of Folders for Each New Project

Another utility I worked on was for a project management group that wanted to have a process where the same set of folders was created for each new project they were assigned. To accomplish this, we created a Google Apps Script that renders an HTML page. From the HTML page, which we added to the Google Apps Launcher, the Project Manager enters a few variables about the project and voilà! A set of folders is created automatically in the Drive destination of their choice (which is hardcoded into the app).

More Use Cases via Webinar

Last year, we hosted a webinar which took a deep dive into the common use cases of Apps Script with Google Workspace for organizations. You can watch the webinar recording for the full demo of Apps Script use cases, or read the blog.

Troubled with Inefficient Processes?

These are just a few of the examples we have come up with in our years of experience, but the possibilities are endless. If you have been troubled with inefficient processes or just looking for Google Drive to do things in a unique way, we’d love to hear from you!