Toast with Google Apps Script

A toast is a small notification window that appears at the bottom right of the screen and usually disappears after a few seconds.

It can be used to confirm that an action has been completed successfully or to display an error message.


Usage Examples

Simple toast with only a message:

SpreadsheetApp.getActive().toast('Message sent');
google sheets toast notification

Toast with a message and a title:

SpreadsheetApp.getActive().toast('The message has been sent!', 'Confirmation');
google apps script toast notification

To modify the default display duration (5 seconds), enter the number of seconds as the third argument:

SpreadsheetApp.getActive().toast('The message has been sent!', 'Confirmation', 3);

To not automatically close the notification, enter a negative value as the third argument:

SpreadsheetApp.getActive().toast('Recipient not found.', 'ERROR', -1);

Then you will need to click on the notification to make it disappear.