- Learning Google Apps Script
- Ramalingam Ganapathy
- 121字
- 2021-07-16 12:40:03
Showing toast when a button is clicked
Toast appears as a popup window in the lower-right corner of the active spreadsheet with a title and message. To create a toast dialog, edit or replace the greeting
function as follows:
function greeting() { SpreadsheetApp.getActiveSpreadsheet() .toast("Hello World!", "Greeting"); }
Now if you click the button, then a toast dialog will appear as shown in the following screenshot, and it disappears within 5 seconds (the default):

You can include a third argument, that is, timeout seconds, in the toast
method. This means how long the toast will be visible for. Put a negative number if you want it to show up forever. For example, toast("Hello World!", "Greeting", -1)
.
Tip
Toast only works in Sheets.
推薦閱讀
- Getting Started with Gulp(Second Edition)
- 高效微控制器C語言編程
- 架構不再難(全5冊)
- 深入淺出Spring Boot 2.x
- ASP.NET Core 2 and Vue.js
- OpenShift在企業中的實踐:PaaS DevOps微服務(第2版)
- 精通Python設計模式(第2版)
- Unreal Engine 4 Shaders and Effects Cookbook
- Python數據結構與算法(視頻教學版)
- Windows內核編程
- Mastering Android Game Development
- FFmpeg開發實戰:從零基礎到短視頻上線
- 零代碼實戰:企業級應用搭建與案例詳解
- Spring 5 Design Patterns
- 深入淺出 HTTPS:從原理到實戰