Returns the UI object used to build menus and show dialogs in Sheets.
class SpreadsheetApp method .getUi()
SpreadsheetApp is the Apps Script service.
.getUi() is the method name you will see after a dot in your code.
What it does
Why it's used
- Add custom menus, sidebars, and dialogs to the spreadsheet toolbar.
- Required before createMenu or showSidebar will show anything.
Common errors
- Forgetting parentheses on getUi. Write SpreadsheetApp.getUi(), not SpreadsheetApp.getUi or getUi by itself.
- Skipping dots between chained calls. Each step needs a dot, like SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Data').getUi().
- Adding spaces where they do not belong. Write SpreadsheetApp.getUi(), not SpreadsheetApp .getUi(), SpreadsheetApp.getUi (), or SpreadsheetApp . getUi().
- Wrong capitalization. Use SpreadsheetApp and getUi, not spreadsheetapp or getui.
Snippets using this method
- Uncheck Every Checkbox in Google Sheets
- Visicalc 2023 Design Walkthrough
- Visicalc 2023 Quick Walkthrough
- Tweet From a Sheet
- SubSpyHub Subreddit Scanner
- Simple Inventory Management Automations
- Self Destructing Google Sheet
- Shaman: AI Blog Writer
- Twitter App Clone in a Google Sheet
- Sheet Stories / Video Notes + Clear 24 Hour Old Videos
- Scrape Google Maps Added Phone and Reviews
- Saving OpenAI API Calls inside of Google Sheets
- I Created an Automatic Emailer
- Make a Tour of Your Sheet
- Introducing SheetFools
- Password Protecting Data In a Google Sheet Part 2 The Basics
- How to Move Tab To End Easily with Apps Script
- How to Insert Multiple Rows in Google Sheets (Easy to Hard)
- How to Merge Cells in Google Sheets
- How to Power Testimonials with Google Forms and Sheets
- Google Maps Scraper for Outreach
- Get Every Editor on Every Google File I Own
- How To Download All Tabs as CSV in a Zip File
- Form Automations: Close Multiple Forms When Over Limit
Explore
Related methods
-
.addToUi()
Publishes a custom menu to the spreadsheet UI.
-
.createMenu()
Builds a custom menu in the spreadsheet toolbar.
-
.showModelessDialog()
Opens a dialog the user can use while still working in the sheet.
-
.showModalDialog()
Opens a modal dialog that blocks interaction with the sheet.
-
.showSidebar()
Opens a custom sidebar built with HtmlService.
More Apps Script
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
Big Year - a Whole Year in One Google Sheets Tab
Breaking Through Errors In Apps Script
Build Your Own AI Writer in Google Sheets
Built a Cookie Clicker Clone in Google Sheets
ChatGPT Clone in Google Sheets Part 1
ChatGPT Clone in Google Sheets Part 2
Count Merged Rows
Create an Automated Task List
Create an Internal Google Sheets Add-on
Create a PR Agency From Scratch
Create Navigation Buttons in Sheets to Other Sheets
Creating A Dark Mode Theme | Announcing Dark Habits
Curate Google Sheets Easily - Automatic Bookmarklet Maker
Deep Inside Dark Habits Google Script
Dylan Asks: How to Automatically Delete Rows If Cell Contains Value
Every Google Drive File Created in Last 24 Hours
Explore Readable Hex Codes
Fast FAQS
Form Automations: Close Multiple Forms When Over Limit
Get Every Editor on Every Google File I Own
Google Maps Scraper for Outreach
Google Sheets Stories? No! But we'll add timestamped video notes to your google sheets.
How To Change Date Format Automatically
How to Create a Google Form Automatically
How to Create AI Images From Google Sheets
How To Download All Tabs as CSV in a Zip File
How To Duplicate a Tab and Move it to the End in Google Sheets
How to Insert Multiple Rows in Google Sheets (Easy to Hard)
How to Merge Cells in Google Sheets
How to Move Tab To End Easily with Apps Script
I Created an Automatic Emailer
Introducing SheetFools
Make a Tour of Your Sheet
Password Protecting Data In a Google Sheet
Password Protecting Data In a Google Sheet Part 2 The Basics
Saving OpenAI API Calls inside of Google Sheets
Scrape Google Maps
Scrape Google Maps Added Phone and Reviews
Self Destructing Google Sheet
Shaman: AI Blog Writer
Simple Inventory Management Automations
SubSpyHub Subreddit Scanner
Tweet From a Sheet
Uncheck Every Checkbox in Google Sheets
Visicalc 2023 Design Walkthrough
Related blog posts
Written guides about SpreadsheetApp.getUi().
How to Use Google Sheets as a Website Database
Did you know you can use Google Apps Script to turn a Google Sheet into a free, auto-syncing database for your website? This guide shows you exactly how to set it up. You’ll prepare your spreadsheet, write a few lines of code and publish your site. Don’t worry if you’re not a developer, we’ll walk you through it. Why Use Google Sheets as a Database? For small projects, Google Sheets offers many advantages over traditional databases: * Free hosting and storage * Easy to edit data without...
Read post →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 →Explore Coding in Google Sheets
Did you know you can actually code in Google Sheets?
Read post →