属性
| 属性 | 类型 | 说明 |
|---|---|---|
Buttons | Button |
方法
| 方法 | 返回类型 | 简介 |
|---|---|---|
input | String|null | 在用户的浏览器中弹出一个包含文本输入框的对话框。 |
input | String|null | 在用户的浏览器中弹出一个包含文本输入框的对话框。 |
input | String|null | 在用户的浏览器中弹出一个包含文本输入框的对话框。 |
msg | String|null | 在用户的浏览器中弹出一个对话框,其中包含指定的消息和一个“确定”按钮。 |
msg | String|null | 在用户的浏览器中弹出一个包含指定消息和按钮的对话框。 |
msg | String|null | 在用户的浏览器中弹出一个对话框,其中包含指定的标题、消息和按钮。 |
详细文档
input Box(prompt)
在用户的浏览器中弹出一个包含文本输入框的对话框。
inputBox 方法会显示一个客户端输入框,向用户显示给定的提示。请注意,此函数会导致服务器端脚本挂起。在用户关闭对话框后,它会自动恢复,但 JDBC 连接不会在暂停期间保持有效。
// The code below sets the value of name to the name input by the user, or // 'cancel'. const name = Browser.inputBox('Enter your name');
参数
| 名称 | 类型 | 说明 |
|---|---|---|
prompt | String | 要在对话框中显示的文本。 |
返回
String|null - 用户输入的文本(如果对话框被取消或关闭,则为“cancel”)。
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
input Box(prompt, buttons)
在用户的浏览器中弹出一个包含文本输入框的对话框。
inputBox 方法会显示一个客户端输入框,其中包含指定提示,并提供可供选择的按钮。请注意,此函数会导致服务器端脚本挂起。在用户关闭对话框后,系统会自动恢复,但 JDBC 连接不会在暂停期间保持有效。
// The code below sets the value of name to the name input by the user, or // 'cancel'. const name = Browser.inputBox('Enter your name', Browser.Buttons.OK_CANCEL);
参数
| 名称 | 类型 | 说明 |
|---|---|---|
prompt | String | 要在对话框中显示的文本。 |
buttons | Button | 要使用的按钮集类型。 |
返回
String|null - 用户输入的文本(如果对话框被取消或关闭,则为“cancel”)。
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
input Box(title, prompt, buttons)
在用户的浏览器中弹出一个包含文本输入框的对话框。
inputBox 方法会显示一个具有指定标题的客户端输入框,该输入框会向用户显示指定提示,并提供可供选择的按钮。请注意,此函数会导致服务器端脚本暂停。在用户关闭对话框后,它会自动恢复,但 JDBC 连接不会在暂停期间保持。
// The code below sets the value of name to the name input by the user, or // 'cancel'. const name = Browser.inputBox( 'ID Check', 'Enter your name', Browser.Buttons.OK_CANCEL, );
参数
| 名称 | 类型 | 说明 |
|---|---|---|
title | String | 对话框的标题。 |
prompt | String | 要在对话框中显示的文本。 |
buttons | Button | 要使用的按钮集类型。 |
返回
String|null - 用户输入的文本(如果对话框被取消或关闭,则为“cancel”)。
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
msg Box(prompt)
在用户的浏览器中弹出一个对话框,其中包含指定的消息和一个“确定”按钮。
msgBox 方法会显示一个客户端消息框,向用户显示指定的消息。请注意,此方法会导致服务器端脚本暂停。在用户关闭对话框后,它会自动恢复,但 JDBC 连接不会在暂停期间保持有效。
// The code below displays "hello world" in a dialog box with an OK button Browser.msgBox('hello world');
参数
| 名称 | 类型 | 说明 |
|---|---|---|
prompt | String | 要在对话框中显示的文本。 |
返回
String|null - 用户点击的按钮的小写文本(或已关闭对话框的“取消”)。
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
msg Box(prompt, buttons)
在用户的浏览器中弹出一个包含指定消息和按钮的对话框。
msgBox 方法会显示一个客户端消息框,其中包含指定的消息,并提供可供选择的按钮。请注意,此方法会导致服务器端脚本暂停。在用户关闭对话框后,系统会自动恢复,但 JDBC 连接不会在暂停期间保持有效。
// The code below displays "hello world" in a dialog box with OK and Cancel // buttons. Browser.msgBox('hello world', Browser.Buttons.OK_CANCEL);
参数
| 名称 | 类型 | 说明 |
|---|---|---|
prompt | String | 要在对话框中显示的文本。 |
buttons | Button | 要使用的按钮集类型。 |
返回
String|null - 用户点击的按钮的小写文本(或已关闭对话框的“取消”)。
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets
msg Box(title, prompt, buttons)
在用户的浏览器中弹出一个对话框,其中包含指定的标题、消息和按钮。
msgBox 方法会显示一个具有指定标题的客户端消息框,该消息框会向用户显示指定消息,并提供一系列可供选择的按钮。请注意,此方法会导致服务器端脚本暂停。在用户关闭对话框后,它会自动恢复,但 JDBC 连接不会在暂停期间保持。
// The code below displays "hello world" in a dialog box with a custom title and // Yes and No buttons Browser.msgBox('Greetings', 'hello world', Browser.Buttons.YES_NO);
参数
| 名称 | 类型 | 说明 |
|---|---|---|
title | String | 对话框的标题。 |
prompt | String | 要在对话框中显示的文本。 |
buttons | Button | 要使用的按钮集类型。 |
返回
String|null - 用户点击的按钮的小写文本(或已关闭对话框的“取消”)。
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/spreadsheets.currentonly -
https://www.googleapis.com/auth/spreadsheets