You have created a function that performs some amazing stuff using Google Apps Script, but the functions that you create run manually when you click a button or a menu item from your Spreadsheet GUI. Since we are talking about automation, we need to run these functions automatically even when the spreadsheet is not open. Luckily, Google provides free time-driven triggers that execute functions automatically even if the spreadsheet itself is not open!
Time-driven triggers can be created in 2 ways, namely from the triggers interface and in code.
Triggers Interface Method:
To access the triggers interface, you need to open the Apps Script
editor from the Extensions
menu of your spreadsheet. Navigate to the Triggers page by clicking on the clock icon from the left sidebar. This opens the list of active triggers (if any). Here, please fill up the form as follows:
- Choose which function to run: choose your function (
getGmailEmails()
is my function from my previous post). - Choose which deployment should run: Head.
- Select event source: Time-Driven.
- Select type of time based trigger: select any type (like Day Timer).
- Select time of day: choose your time interval.
You may repeat these steps again for whatever time or whatever function you would like the trigger to run on. I advise not to create triggers that less than 10 minutes.
Below is a screen recording which shows how to create time-driven triggers:
Triggers from Code Method:
I will cover how triggers can be created in code in the next post update.
A highly committed and skillful software engineer with years of experience in developing business solutions and productivity tools that empower businesses to acheive more in less time.
Feel free to contact me over email for help.
I LOVE IT