onEdit Simple Trigger not working when Publish Test as Add-on

Viewed 1147

I have been banging my head on this for awhile now...my document bound google app script works great when testing local to the document. I tried to test as publish > Test as Add-on with another sheet. Although my onInstall() and onOpen() simple triggers worked fine, my onEdit function did not.

I created this simple code below to find the root cause of my onEdit issue, but even this simple code does not work. I created a new sheet with a bound script. I then tested in another sheet, again the onInstall() and onOpen() worked fine, the opOpen menu even called my on Edit function, but when editing a cell nothing happens. Any help is appreciated, I would like to get this to work with simple triggers not installable triggers, as this seems like a really simple use case.

function onOpen(e) {
  var ui = SpreadsheetApp.getUi();

  ui.createMenu('Test Menu')
    .addItem('Hello', 'onEdit')
    .addToUi();
}

function onInstall(e) {
  onOpen(e);
}

function onEdit(e) {
  Logger.log('ran onedit!');
  SpreadsheetApp.getUi().alert('Hello');
}
1 Answers
Related