简体   繁体   中英

Configuring an Installable Trigger in Apps Script for a Company Wide Add-on

So I have created a G Apps Script and I need to manually install the onEdit trigger. However I ran into an authorization issue, so now I am trying to do it this way. I am following the following suggestionfrom a previously asked StackOverflow question . However when I look into my execution logs, my onOpen runs but I never get a pop up or any ui show up. Please advise how to correctly setup installable onEdit trigger for an editor-addon that utilizes elevated AUTH mode.

function onInstall(e)
{
      onOpen(e); 
}
function onOpen(e)
{
  let ui = SpreadsheetApp.getUi();
  ui.createAddonMenu()
  .addItem('Please click here to get started', 'addTriggers')
  .addToUi();
}

function addTriggers()
{
    var ss = SpreadsheetApp.getActiveSpreadsheet();
    ScriptApp.newTrigger('myOnEdit')
      .forSpreadsheet(ss)
      .onEdit()
      .create();

}

I figured out my issue, basically the .createAddonMenu() is not the same as .createMenu() because the Addon one was hidden and all I had to do was go in there and press it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM