0
0
Google Sheetsspreadsheet~5 mins

Creating custom menus in Google Sheets - Complete Walkthrough

Choose your learning style9 modes available
Introduction
Custom menus let you add your own menu options to Google Sheets. This helps you run special tasks or scripts easily without typing commands every time.
When you want to run a script with one click instead of opening the script editor.
When you share a sheet and want others to use your custom tools easily.
When you have repetitive tasks like formatting or data cleanup and want a quick button.
When you want to organize multiple scripts under one menu for easy access.
When you want to add special functions that Google Sheets does not have by default.
Steps
Step 1: Open
- Google Sheets file
Your spreadsheet is ready for editing
Step 2: Click
- Extensions menu > Apps Script
The Apps Script editor opens in a new tab
Step 3: Delete any code in the script editor and type
- Apps Script editor
You have a blank script to write your custom menu code
💡 Use the example code below to create a simple custom menu
Step 4: Type the following code
- Apps Script editor
Code defines a custom menu and a function to run
💡 This code adds a menu named 'My Menu' with one item 'Say Hello'
Step 5: Click
- Save icon in Apps Script editor
Your script is saved
Step 6: Close
- Apps Script editor tab
Return to your Google Sheets file
Step 7: Reload
- Google Sheets tab
The new custom menu appears in the menu bar
Step 8: Click
- New custom menu (e.g., 'My Menu') > menu item (e.g., 'Say Hello')
The script runs and shows a popup message
Before vs After
Before
Google Sheets menu bar shows only default menus like File, Edit, View
After
Google Sheets menu bar shows a new menu named 'My Menu' with a clickable item 'Say Hello'
Settings Reference
onOpen function
📍 Apps Script editor
Runs automatically when the spreadsheet opens to add your custom menu
Default: No custom menu
Menu name
📍 Code inside onOpen function
The name shown in the Google Sheets menu bar
Default: No menu
Menu item name
📍 Code inside onOpen function
The name of the clickable item inside your custom menu
Default: No menu item
Function to run
📍 Code inside onOpen function
The script function that runs when the menu item is clicked
Default: No function
Common Mistakes
Not naming the function 'onOpen' to create the menu
Google Sheets only runs the onOpen function automatically when the sheet opens
Always name your menu creation function 'onOpen' so it runs on file open
Forgetting to reload the spreadsheet after saving the script
The custom menu only appears after the sheet reloads and runs onOpen
Reload the Google Sheets tab after saving your script to see the menu
Using a menu item function that is not defined in the script
Clicking the menu item will cause an error if the function does not exist
Define all functions you link to menu items in the script
Summary
Custom menus let you add your own menu options to Google Sheets for easy script access.
You create custom menus by writing an onOpen function in the Apps Script editor.
Remember to reload your sheet after saving the script to see the new menu.