I'm writing this Workspace Sheets Add-On and have this simple installable trigger set to trigger whenever a the spreadsheet is opened:
function whenOpen(e) {
Logger.log('Open trigger ' + JSON.stringify(e));
}
const ss = SpreadsheetApp.getActive();
const currentTriggers = ScriptApp.getUserTriggers(ss);
if (currentTriggers.length == 0) {
ScriptApp.newTrigger('whenOpen').forSpreadsheet(ss).onOpen().create();
}
When testing it, I can see that it gets triggered successfully on my own account from project executions and I see a message that looks like Open trigger {"authMode":"FULL","source":{},"triggerUid":"[...]","user":{[...]}}
.
When I run this from a different account on the same spreadsheet, the event seems to get sent but I just see immediate failure instead with no logs with any additional information:
Perhaps this is some authentication issue? I understand the trigger will be run from the context of the user that installs the trigger (based on this) but I still expect it to run without error. I thought it might be a scoping issue but I'm already requesting https://www.googleapis.com/auth/script.scriptapp
to allow for scripts to run in the background.
My questions:
- Is there any way to get more detailed error messages to why this is failing?
- What is causing this trigger to fail to run?