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.


Have feedback for me?

I'd appreciate any feedback you can give me regarding this post.

Was it useful? Are there any errors or was something confusing? Would you like me to write a post about a related topic? Any other feedback is also welcome. Thank you so much!