Google Spreadsheet API has various methods for setting the active Spreadsheet, Sheet, Range, column, and so forth, programmatically. These methods can be used from triggered scripts that run when the UI isn't open. However, I don't see any documentation explaining how long this activation persists.
Experience and intuition suggests that when, say, a spreadsheet is activated programmatically, it is "active" in the global scope, and will stay active until the original function call ends. However, I am afraid I will be surprised by some edge case if this is not exactly right.
For example, if I have a bound script that is triggered to run on Friday, and it calls another bound script which activates a spreadsheet, it seems that the spreadsheet remains active after that second script closes, and another script call can still "getActiveSpreadsheet". However, if the triggered script terminates, and another script is triggered 5 minutes later, you would have to activate it by ID again.
Is there any documentation, or is my understanding complete?
As an example, consider a case where one Google Service's API is triggered by the result of a change caused by a triggered function in a separate service.
It is not discussed in the document on how long the document is active or could remain active. But it is written as long as it is being displayed in the spreadsheet UI it is the active sheet.