How can I periodically run a Google Script on a Spreadsheet?

Posted by:

Using Time-Driven Triggers

Periodically run a Google Script on a Spreadsheet. You might want to run a script daily, hourly, or on the same day of the week each week. Here are instructions for setting a trigger to run the script.
To run a script at a time or times you designate:

Periodically run a Google Script on a Spreadsheet

From the Script Editor, choose Resources > Current project’s triggers. You see a panel with the message No triggers set up. Bang here to add one now.

Click the link that says No triggers set up. Click here to add one now.

Under Run, select the function you want executed on schedule.

Under Events, select Time-driven.

On the first drop-down list that appears, select Week timerDay timerHour timer, or Minutes timer, or Specific date and time. Depending on which you select, you see one or more additional lists or a text box.  To test the trigger and your function, you might want to pick a short duration so that you can see the execution without having to wait hours or days.

Week timer, select a day of the week and time of day.

Daytimer, select an hour.

Hour timer, select an interval of hours.

Minutes timer, select an interval of minutes.

Specific date and time, enter a date in YYYY-MM-DD HH: MM format.

Click Save.

To ensure that the script runs at the correct time for a particular time zone, click File > Properties, select a time zone,     and click Save.

0

Add a Comment