title: When the spreadsheet is refreshed or closed the menu item disappears
body: <p>I am trying to create a script that will makes a menu item in Google Sheets to send an email when pressed. The menu item will appear when I press run on script editor but then when the Google Sheet is refreshed or closed the menu item disappears.</p>
  
  <p>The code I have was originally working but for some reason no longer works.</p>
  
  <pre><code>function onOpen() {
    var ss = SpreadsheetApp.openById("1j2Q58oxxcTS-QYmdvaEiNWgyRagqF17rv8o3tYWB1TQ");
    var menu = [{name: "Submit", functionName:"myFunction"}];
     ss.addMenu("Submit Booking", menu)
  
  }
  
  function myFunction() {
  
    var source = SpreadsheetApp.openById("1j2Q58oxxcTS-QYmdvaEiNWgyRagqF17rv8o3tYWB1TQ");
    var email = "removed for privacy reasons";
     var subject = "New Buffel Park Travel Bookings";
    var link = "https://docs.google.com/spreadsheets/d/1j2Q58oxxcTS-QYmdvaEiNWgyRagqF17rv8o3tYWB1TQ/edit#gid=1832370497";
    var message = "New bookings have been submitted for Buffel Park site staff.";
    var html_message = "&lt;p&gt;New bookings have been submitted for Buffel park site staff."+
                       "&lt;p&gt;"+
                       "&lt;p&gt;Booking details can be found &lt;a href=\""+link+"\"&gt;here.&lt;/a&gt;"+
                       "&lt;p&gt;"+
                       "&lt;p&gt;A PDF copy of the sheet at time of submission is also attached to this email.";
  
    var pdf = DriveApp.getFileById(source.getId()).getAs('application/pdf').getBytes();
    var attach = {fileName:'Buffel Park Travel Booking.pdf',content:pdf, mimeType:'application/pdf'};
  
    MailApp.sendEmail (email, subject, message, {htmlBody: html_message,attachments:[attach]});
  
     var cc = Session.getActiveUser().getEmail();
    var sub = "New bookings have been submitted for Buffel Park site staff.";
  
    var html = "&lt;p&gt;New bookings have been submitted for Buffel park site staff."+
                       "&lt;p&gt;"+
                      "&lt;p&gt;A PDF copy of the sheet at time of submission is also attached to this email.";
      MailApp.sendEmail (cc, sub, message, {htmlBody: html,attachments:[attach]});
  }
  </code></pre>
  
  <p>I just need the button to stay where it is so it sends an email prompt for the request</p>