We looked at how to create a json file on Google Drive containing the analysis of a google site in Analyzing site content with GAS. The script that creates that takes a whole lot of parameters, and we wouldn't want to run that manually all the time. Ideally we would just want to run that thing from time to time. That's where GAS triggers come in.
In the script editor under resources, there's an option to set up triggers.
To set up a timed trigger just choose the function that you want to run, and select when and how often it should run.
Here, I'm executing a function called 'timed' every night around midnight.
I want to call my doGet(e) function, just as if I'd called it from a browser. However, I still need to pass the url parameters. Here's how.
It's straightforward to simulate how GAS converts parameters as arguments, and now this will run every night, refreshing the site analysis data. See Analyzing site content with GAS for the details of what doGet() is doing in this example.
For help and more information join our forum,follow the blog or follow me on twitter .
Services > Desktop Liberation - the definitive resource for Google Apps Script and Microsoft Office automation > GAS and sites >