title: onEdit(e) not working in Add-on
body: <p>I've written a script that works great when used in a native spreadsheet.  I am now trying to publish it as a Add-on, and am finding that <code>onEdit(e)</code> is not working, when <code>onOpen(e)</code> and <code>onInstall(e)</code> work fine.</p>
  
  <p>I've looked over the documentation on Authorization modes and installing/enabling an Add-on, but I think I am probably missing something (hopefully straightforward) since I am a beginner.  Should I be calling the functions differently?  Or the placement of the <code>onEdit</code>?  Any help is appreciated.  Thanks!!</p>
  
  <pre><code>function setup() {
    var ui = SpreadsheetApp.getUi();
    var ss = SpreadsheetApp.getActiveSpreadsheet();
    var sheet = ss.getSheetByName('Send Auto Emails');
  
    try {ss.setActiveSheet(ss.getSheetByName('Send Auto Emails'));}
    catch (e) {ss.insertSheet('Send Auto Emails', 0);}
  
    sheet.getRange(1, 1).setValue('Recipient Email Address');   
  
    //etc...
  }
  
  function onEdit(e) {
    var ss = SpreadsheetApp.getActiveSpreadsheet();
    var sheet = e.source.getActiveSheet();
    var range = e.source.getActiveRange();
  
    if (range.getA1Notation() == "C1" | range.getA1Notation() == "D1" |     range.getA1Notation() == "E1" &amp;&amp; sheet.getName() == "Send Auto Emails") {
      Browser.msgBox(
        'Alert',
        'Feel free to change the title here to something more relevant to you.  But be aware, if you would like to use an optional item, please make sure you are referencing it in your email message exactly as it appears here, wrapped in &lt; and &gt;. Example: &lt;Optional Item 1&gt;.',
        Browser.Buttons.OK
      );
    }
    if (range.getA1Notation() == "J4" &amp;&amp; sheet.getName() == "Send Auto     Emails") {
      Browser.msgBox(
        'Alert',
        'Only add the email message body.  "Hello, Recipient Name" and "Best, Your Name" will be automatically added.  If you would like to use Optional Items in this message, see the example text to make sure you are using them the right way.',
        Browser.Buttons.OK
      );
    }
  
    if (range.getA1Notation() == "A2") {
      ss.toast("Your data in column A must not be separated by any blank rows. Any data after a blank row will be ignored.", "Be aware", 90);
    }
  }
  
  function onOpen(e) {
    var ui = SpreadsheetApp.getUi();
    ui.createMenu('BulkEmail beta')
        .addItem('1. Sheet Setup', 'setup')
        .addItem('2. Send Emails', 'sendEmails')
        .addToUi();
    onEdit(e);
  }
  
  function onInstall(e) {
    onOpen(e);
  }
  </code></pre>
  
  <p><strong>EDIT 1</strong></p>
  
  <p>I've tried creating an installable trigger instead of using the simple <code>onEdit</code>, still to no avail.</p>
  
  <pre><code>function createonEdit() {
    var ss = SpreadsheetApp.getActiveSpreadsheet();
    ScriptApp.newTrigger('installableonEdit')
        .forSpreadsheet(ss)
        .onEdit()
        .create();
  }
  
  function installableonEdit(e) {
    var ss = SpreadsheetApp.getActiveSpreadsheet();
    var sheet = e.source.getActiveSheet();
    var range = e.source.getActiveRange();
  
    try {
      if (range.getA1Notation() == "C1" | range.getA1Notation() == "D1" | range.getA1Notation() == "E1" &amp;&amp; sheet.getName() == "Send Auto Emails") {
        Browser.msgBox(
          'Alert',
          'Feel free to change the title here to something more relevant to you.  But be aware, if you would like to use an optional item, please make sure you are referencing it in your email message exactly as it appears here, wrapped in &lt; and &gt;. Example: &lt;Optional Item 1&gt;.',
          Browser.Buttons.OK
        );
      }
      if (range.getA1Notation() == "J4" &amp;&amp; sheet.getName() == "Send Auto Emails") {
        Browser.msgBox(
          'Alert',
          'Only add the email message body.  "Hello, Recipient Name" and "Best, Your Name" will be automatically added.  If you would like to use Optional Items in this message, see the example text to make sure you are using them the right way.',
          Browser.Buttons.OK
        );
      }
  
      if (range.getA1Notation() == "A2") {
        ss.toast("Your data in column A must not be separated by any blank rows. Any data after a blank row will be ignored.", "Be aware", 90);
      }
    } catch(err) {
      var errMsg = 'There was an error: ' + err +
          + " \n \n" +
          'from the: onEdit function ' +
          + " \n \n" +
          'The call stack is: ' + err.stack;
  
      GmailApp.sendEmail('elisabeth@groupon.com', "error", errMsg);
    }
  }
  </code></pre>