create menu in spreadsheet app scrip code example

Example: create menu in spreadsheet app scrip

function onOpen( ){
// This line calls the SpreadsheetApp and gets its UI   
// Or DocumentApp or FormApp.
  var ui = SpreadsheetApp.getUi();
 
//These lines create the menu items and 
// tie them to functions we will write in Apps Script
  
 ui.createMenu('Custom Functions')
      .addItem('Get Range', 'getRange')
      .addSeparator()
      .addSubMenu(ui.createMenu('Advanced Options')
          .addItem('Get Range Values', 'getRangeValues'))
      .addToUi();
}

Tags:

Misc Example