class SpreadsheetApp method .prompt()

SpreadsheetApp is the Apps Script service.

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

What it does

Shows a dialog that asks the user for text input.

Why it's used

  • Ask for a sheet name, email, or ID before the script continues.
  • Lightweight input without building a full HTML dialog.

Common errors

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

1 Snippets using this method

Explore

Related methods

  • .alert()

    Shows a simple alert box with an OK button.

  • .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.

  • .toast()

    Shows a short message in the bottom corner of the spreadsheet.

  • .activate()

    Makes a sheet or range the active selection.

1 Better Sheets tutorials

Add Columns Automatically

Add Columns Automatically

Create your own "Add Columns" button just like the add rows to the bottom.

Related blog posts

Written guides about SpreadsheetApp.prompt().

Browse the blog