Adds a menu item that runs a function when clicked.
class SpreadsheetApp method .addItem()
SpreadsheetApp is the Apps Script service.
.addItem() is the method name you will see after a dot in your code.
What it does
Why it's used
- Wire each menu entry to a function like send report or clean data.
- Give non-technical teammates one-click access to your code.
Common errors
- Forgetting parentheses on addItem. Write SpreadsheetApp.addItem(), not SpreadsheetApp.addItem or addItem by itself.
- Skipping dots between chained calls. Each step needs a dot, like SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Data').addItem().
- Adding spaces where they do not belong. Write SpreadsheetApp.addItem(), not SpreadsheetApp .addItem(), SpreadsheetApp.addItem (), or SpreadsheetApp . addItem().
- Wrong capitalization. Use SpreadsheetApp and addItem, not spreadsheetapp or additem.
11 Snippets using this methods
- Automatically Copy Spreadsheet Tab to New File with Values Only, No Formulas
- Automate Move Blank Rows
- Automatically Align Top
- Automatically Clear Content | Refresh Reuse Recycle Templates
- Automatic Calculations
- Add Columns Automatically
- Add Tasks to Google Tasks From Google Sheets
- Advanced Coding in Google Sheets for Programmers
- Americano Tournament Template With Four Automations
- Access Free API's with Google Sheets
- Activate A Certain Sheet When Opening a Spreadsheet
Explore
Related methods
-
.createMenu()
Builds a custom menu in the spreadsheet toolbar.
-
.addToUi()
Publishes a custom menu to the spreadsheet UI.
-
.insertSheet()
Adds a new sheet tab to the spreadsheet.
-
.addSeparator()
Adds a divider line between menu items.
-
.activate()
Makes a sheet or range the active selection.
More Apps Script
12 Better Sheets tutorials
Access Free API's with Google Sheets
Activate A Certain Sheet When Opening a Spreadsheet
Add Columns Automatically
Add Tasks to Google Tasks From Google Sheets
Advanced Coding in Google Sheets for Programmers
Americano Tournament Template With Four Automations
Automate Emails
Automate Move Blank Rows
Automatically Align Top
Automatically Clear Content | Refresh Reuse Recycle Templates
Automatically Copy Spreadsheet Tab to New File with Values Only, No Formulas
Related blog posts
Written guides about SpreadsheetApp.addItem().
What's Better Than Google Sheets?
Nothing is better than Google Sheets. You just need to learn more about the unlimited power of Google Sheets. Functions, Formulas, Apps Script and more.
Read post →How to reference a different Google Spreadsheet in Apps Script?
Transferring Data Between Cells in Different Spreadsheets
Read post →How to Send Google Forms Entries Automatically with Apps Script
Google Forms provides basic email notifications for form submissions, but enhancing these notifications with detailed summaries can significantly improve productivity and response management.
Read post →