Opens a modal dialog that blocks interaction with the sheet.
class SpreadsheetApp method .showModalDialog()
SpreadsheetApp is the Apps Script service.
.showModalDialog() is the method name you will see after a dot in your code.
What it does
Why it's used
- Collect input or confirm a destructive action before it runs.
- Show a settings form the user must complete first.
Common errors
- Forgetting parentheses on showModalDialog. Write SpreadsheetApp.showModalDialog(), not SpreadsheetApp.showModalDialog or showModalDialog by itself.
- Skipping dots between chained calls. Each step needs a dot, like SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Data').showModalDialog().
- Adding spaces where they do not belong. Write SpreadsheetApp.showModalDialog(), not SpreadsheetApp .showModalDialog(), SpreadsheetApp.showModalDialog (), or SpreadsheetApp . showModalDialog().
- Wrong capitalization. Use SpreadsheetApp and showModalDialog, not spreadsheetapp or showmodaldialog.
Explore
Related methods
-
.showModelessDialog()
Opens a dialog the user can use while still working in the sheet.
-
.prompt()
Shows a dialog that asks the user for text input.
-
.alert()
Shows a simple alert box with an OK button.
-
.activate()
Makes a sheet or range the active selection.
-
.showSidebar()
Opens a custom sidebar built with HtmlService.
More Apps Script
Better Sheets tutorials
No tagged tutorials yet. Fetch Apps Script from the harvest table and this page fills automatically.
Related blog posts
Written guides about SpreadsheetApp.showModalDialog().