class SpreadsheetApp method .alert()

SpreadsheetApp is the Apps Script service.

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

What it does

Shows a simple alert box with an OK button.

Why it's used

  • Tell the user something went wrong in plain language.
  • Confirm a count like updated 12 rows.

Common errors

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

Explore

Related methods

  • .prompt()

    Shows a dialog that asks the user for text input.

  • .toast()

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

  • .showModalDialog()

    Opens a modal dialog that blocks interaction with the sheet.

  • .showModelessDialog()

    Opens a dialog the user can use while still working in the sheet.

  • .addItem()

    Adds a menu item that runs a function when clicked.

Better Sheets tutorials

Add Columns Automatically

Add Columns Automatically

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

Automate Emails

Set up automated email notifications based on Google Sheets data. Super ...
Automatic Calculations

Automatic Calculations

Create custom scripts to make your spreadsheets more like tools.
Built a Cookie Clicker Clone in Google Sheets

Built a Cookie Clicker Clone in Google Sheets

I built a clone of Cookie Clicker, live on YouTube. Watch the full 1 hou...
Creating A Dark Mode Theme | Announcing Dark Habits

Creating A Dark Mode Theme | Announcing Dark Habits

Build a habit tracker in dark mode. Learn how to use emojis and checkbox...
Curate Google Sheets Easily - Automatic Bookmarklet Maker

Curate Google Sheets Easily - Automatic Bookmarklet Maker

Curated sites, articles, and more web resources super easily into a Goog...
Deep Inside Dark Habits Google Script

Deep Inside Dark Habits Google Script

Go inside this apps script and sheet. See how it's designed and created.
Different Kinds of Automation

Different Kinds of Automation

A brief description of types of automation. I go way more in depth in “M...
Get Every Editor on Every Google File I Own

Get Every Editor on Every Google File I Own

Get every editor if you're looking for the sheets and documents you've s...
Google Maps Scraper for Outreach

Google Maps Scraper for Outreach

Get this fun template to search on google maps via API, and quickly mess...
Google Sheets Stories? No! But we'll add timestamped video notes to your google sheets.

Google Sheets Stories? No! But we'll add timestamped video notes to your google sheets.

There was a stories craze. Every app/platform/business was adding 24 hou...
How To Download All Tabs as CSV in a Zip File

How To Download All Tabs as CSV in a Zip File

Download All Tabs as CSV in a Zip File, instead of downloading each one ...
Make a Tour of Your Sheet

Make a Tour of Your Sheet

create a tour of your sheet for users who might be using your sheet and ...
Sheet Stories / Video Notes + Clear 24 Hour Old Videos

Sheet Stories / Video Notes + Clear 24 Hour Old Videos

Revolutionary Method to Manage Your Video Stories! Learn how to delete o...
Tweet From a Sheet

Tweet From a Sheet

See how to tweet from a sheet and get the code below.
Twitter App Clone in a Google Sheet

Twitter App Clone in a Google Sheet

I built a twitter clone in Google Sheets
Visicalc 2023 Design Walkthrough

Visicalc 2023 Design Walkthrough

Design walkthrough of VisiCalc 2023. Watch this if you'd like to see the...
Visicalc 2023 Quick Walkthrough

Visicalc 2023 Quick Walkthrough

This is a fun template I created for April 1st. Take a quick walk throug...

Related blog posts

Written guides about SpreadsheetApp.alert().

Browse the blog