I have 'discovered' the Sidebar functionality in Google Spreadsheet. Very neat.
I have different tabs and the Sidebar acts as a help function. If I select the next step in the Sidebar, I can open the tab that contains the next step.
Now I'm kind of stuck. When the user selects a different tab, I like to populate the Sidebar with corresponding information.
Though I know how to fill the information, I'm looking for the 'trigger' to run the function.
So my question boils down: how do I capture the change tab event?
In order to get it to work, I needed to add the following in the beginning of the HTML
Use the poller technique demonstrated in How to poll a Google Doc from an add-on. Unlike a time-based trigger, this relies on a client-side delay loop in the sidebar html to make calls to your script on Google's servers.
Here's how you can modify the example from that question.
in Code.gs
DocumentApp
withSpreadsheetApp
in HTML
poll()
function with this one.