1
votes

Why would Time-Driven triggers not call any ‍‍‍‍SpreadsheetApp.getUi or Browser.xxx(), functions?

If I manually play the function, the lines are executed, but with a time based trigger, the function is called, all other lines are executed, except any calls to the above.

I wanted a time-driven trigger to display an alert on a spreadsheet based on the time freq set.

Here is a simple code, Time-driven trigger set to run every minute as an example. Tried it with various other time settings.

function InputTime()
{

Logger.log("This code ran");     // This works fine.

SpreadsheetApp.getUi().alert("Warning 1");        // Does not work

this.SpreadsheetApp.getUi().alert("warning 2");   // Does not work

Browser.msgBox("warning 3");                     // Does not work
}

Any idea? Also, modifying the values in the sheet by first getting the Id of the sheet and the sheet name ( as suggested by Sergi here), allows the sheet to be editied fine. Similarly is there any way to tie Alert notifications to the particular spreadsheet?

1

1 Answers

3
votes

Time-Driven triggers functions are unable to interact with Ui, they run in their own scope , independently of your session.

This is the intended behavior, nothing you can do about it.