Home » Google » Trigger An Action from Google Sheets

Trigger An Action from Google Sheets

We all need things to happen automatically! It isn’t just teachers who wish we had a magic wand and that things would just be done for us. While I do not have a magic wand, triggers can help automate some actions. Google Sheets is one of the easiest ways to accomplish this since you can create Macros in Sheets (record your steps and it automates your code for you) and then turn on a trigger to make it happen on a schedule.

For example: I run detention every morning. I fill into a Google Form the students ID number. This goes from the Form to the Spreadsheet (that is a regular function of Google Forms). I have a vlookup formula to look up the students name. I use the Add-on Copy Down to automatically set the students name as part of the Form results in the spreadsheet. 
Then I have a trigger that automatically every day emails the entire school with the list of students who served in detention. 

So every day my full effort is simply typing in the student ID number. The rest automatically happens every day.

Want More Help with This? Become a Premium Member

Coding Google Docs, Sheets, Slides, Forms

You can code Google Docs, Sheets, Slides, Forms, etc… with Google Apps Script. This does require some knowledge in coding with JavaScript. EXCEPT Google Sheets. Google Sheets allows you to no code create a macro.

Create a Macro

Using Google Sheets, what steps do you do regularly that you would like to have happen automatically? Use the Tools menu and select “Record Macro.” In the video above I have given an example of recording a Macro. Ignore the example, the example is irrelevant. I am simply showing that I might want to do the same thing each day. Notice that as I insert a row and insert a formula that it is recorded in the Macro recorder.

Macros save your steps as Google Apps Script, but you did not have to code any of it! It is done for you automatically.

Script Editor

Docs, Sheets, Slides, Forms, and more have a Script Editor. In this script editor you can add Google Apps Script code. Note that while the video example shows Google Sheets, you can actually set a trigger in any of these products.

Google Apps Script from a macro in the script editor. Click on triggers icon, looks like a clock, on the left hand side.

Set a Trigger

In Docs, Sheets, Slides, Forms, etc.. go to the Script Editor. To set automation for your Google Apps Script functions (or Macros) look for the clock icon on the left hand side. This allows you to create a new trigger.

Double check the function when creating a new trigger. Change the event to Time Driven.

The first option is which function you want to automatically run. Double check that the function (or Macro) that you want to automate is what it is showing.

Select Event Source

Under “Select event source” choose “Time-driven.” In the case of a Google Sheets spreadsheet that came from a Google Form, you can select “On Form Submit” For Time-driven triggers, select how often you want the set of steps to run automatically. If once a day choose the “Day” option and select the hour that you want it to automatically run.

Save! That is it. You can have things happen automatically every day by using a Trigger.

BETTER – Print Google Form Quiz

Have more control over how your Google Form™ Quiz prints. Sometimes you need your Google Form on paper and this solution will help you to do it better! Print Google Form Quiz to a Google Doc and custo…

Something Fun for the End of the Year

What is something fun for students to do at the end of the year? While there are many choices, a fun word search can give students something to do while other students are finishing a task. Try my tem…

Collaborate with Students – reuse TemplateTab

Reuse TemplateTab to collaborate with students and have less paperwork to grade.

First S

CS First is a great way to get started with teaching students computer science even if you as the teacher do not have experience with coding or computer science. First s … science! It is critical th…

4 Tips for Google Bookmark

4 Tips for Google Bookmark. If you use Chrome here are some ways to use the Bookmarking feature.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.