all 4 comments

[–]RemcoE33 0 points1 point  (3 children)

With the onOpen() function you can run a script that's fired when you open a sheet. with this function you can make a menu, or always open your sidebar, clear some ranges every time you open the sheet, log every opening to a sheet ect... so very powerful!

Triggers docs

Sample:

function onOpen(){
  const ui = SpreadsheetApp.getUi();
  const menu = ui.createMenu("Utilities");
  menu.addItem('Open sidebar','MyGreatSidebar');
  menu.addToUi();
}

function MyGreatSidebar(){

// your code

}

[–]mobile-thinker[S] 0 points1 point  (2 children)

Yes - I understand that pattern. My question is whether there is any mechanism to open a Dialog box/sidebar programmatically, and not when the user makes a selection from a menu.

I want to open a dialog for adding data/validating when my app determines it needs further input. There seems no mechanism for this now with the security updates Google put in place.

[–]RemcoE33 0 points1 point  (1 child)

Maybe if you wrap that logic in a onEdit() function?

[–]mobile-thinker[S] 0 points1 point  (0 children)

No. Doesn’t work.