class SpreadsheetApp method .createMenu()

SpreadsheetApp is the Apps Script service.

.createMenu() is the method name you will see after a dot in your code.

What it does

Builds a custom menu in the spreadsheet toolbar.

Why it's used

  • Add a custom menu so users run your scripts from the toolbar.
  • Package several functions behind one menu.

Common errors

  • Forgetting parentheses on createMenu. Write SpreadsheetApp.createMenu(), not SpreadsheetApp.createMenu or createMenu by itself.
  • Skipping dots between chained calls. Each step needs a dot, like SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Data').createMenu().
  • Adding spaces where they do not belong. Write SpreadsheetApp.createMenu(), not SpreadsheetApp .createMenu(), SpreadsheetApp.createMenu (), or SpreadsheetApp . createMenu().
  • Wrong capitalization. Use SpreadsheetApp and createMenu, not spreadsheetapp or createmenu.

Explore

Related methods

  • .addToUi()

    Publishes a custom menu to the spreadsheet UI.

  • .addItem()

    Adds a menu item that runs a function when clicked.

  • .showSidebar()

    Opens a custom sidebar built with HtmlService.

  • .addSeparator()

    Adds a divider line between menu items.

  • .getUi()

    Returns the UI object used to build menus and show dialogs in Sheets.

11 Better Sheets tutorials

Access Free API's with Google Sheets

Access Free API's with Google Sheets

Get Kanye Quotes, Hogwarts Houses, Public Holidays, and more fun with AP...
Activate A Certain Sheet When Opening a Spreadsheet

Activate A Certain Sheet When Opening a Spreadsheet

Create a short function that runs every time a spreadsheet file is open....
Add Columns Automatically

Add Columns Automatically

Create your own "Add Columns" button just like the add rows to the bottom.
Add Tasks to Google Tasks From Google Sheets

Add Tasks to Google Tasks From Google Sheets

Create tasks in Google Tasks from Google Sheets using Apps Script
Americano Tournament Template With Four Automations

Americano Tournament Template With Four Automations

Created a tournament template with 4 automations. So tabs can be copied ...
Automate Emails

Automate Emails

Set up automated email notifications based on Google Sheets data. Super ...
Automate Move Blank Rows

Automate Move Blank Rows

Automate the apps script we just created that moves blank rows from one ...
Automatically Align Top

Automatically Align Top

Automate formatting cells to align top. Either by a time-based trigger o...
Automatically Clear Content | Refresh Reuse Recycle Templates

Automatically Clear Content | Refresh Reuse Recycle Templates

Create automatic functions to clear content.
Automatically Copy Spreadsheet Tab to New File with Values Only, No Formulas

Automatically Copy Spreadsheet Tab to New File with Values Only, No Formulas

Automatically copy a spreadsheet tab to a whole new spreadsheet file, ge...
Automatic Calculations

Automatic Calculations

Create custom scripts to make your spreadsheets more like tools.

Related blog posts

Written guides about SpreadsheetApp.createMenu().

Browse the blog