Displaying notifications in Google Sheets using toasts

A toast is a notification that provides some contextual information to the user in an unobtrusive manner. A toast notification will automatically disappear after a few seconds.

In Google Sheets, toast notifications are displayed in the bottom right corner of the screen.

A screenshot of Google Sheets showing a toast notification in the lower right corner.

It's really simple to write the code to display toast notifications. For example, the code to display the prompt in the above image is just one line.

function toastMessage() {
  SpreadsheetApp.getActive().toast("Message");
}

You can also include a title along with the message.

function toastMessageTitle() {
  SpreadsheetApp.getActive().toast("Message", "Title");
}
A screenshot of Google Sheets showing a toast notification in the lower right corner.

Finally, you can configure the number of seconds the notification should be shown.

function toastMessageTimeout() {
  // Display the toast for 15 seconds
  SpreadsheetApp.getActive().toast("Message", "Title", 15);
}

Conclusion

In this tutorial, you learned how to display toast notifications in Google Sheets using Google Apps Script.

Thanks for reading.

Sign up to be notified when I publish new content

By signing up you agree to the Privacy Policy & Terms.