I've started experimenting with the timer installable trigger but I've run into an issue. I would like this function to run every minute on behalf of the user who opened a deployed web app link.
The project has the right authorization scope in the appsscript.json file but the timer execution always fails.
I tried reducing everything out of the program until it was the most basic it could be and it still always failed.
Here is the very simplified code:
function doGet() {
ScriptApp.newTrigger('execute')
.timeBased()
.everyMinutes(1)
.create();
}
function execute() {
for (var i = 1; i <= 10; i++) {
Logger.log(i);
}
}
It seems like it has something to do with the timer trigger itself because the code I've tested inside of it seems irrelevant.
Any help would be much appreciated.
Edit:
I believe the issue was because it didn't want to allow the 3rd party account to run my code on behalf of them even though I had the auth scopes.
my solution was to send a spreadsheet 'copy' link instead of a web app and prompt them to run the code via image in the spreadsheet once they copied the sheet (which also copies the attached code). It then ran the timer trigger code fine, I suspect because it was happy it was running its own code and not someone else's.