我的目标
// Display a dialog box with a title,message,input field,and "Yes" and "No" buttons. The
// user can also close the dialog by clicking the close button in its title bar.
var ui = Spreadsheetapp.getUi();
var response = ui.prompt('Getting to know you','May I know your name?',ui.ButtonSet.YES_NO);
// Process the user's response.
if (response.getSelectedButton() == ui.Button.YES) {
Logger.log('The user\'s name is %s.',response.getResponseText());
} else if (response.getSelectedButton() == ui.Button.NO) {
Logger.log('The user didn\'t want to provide a name.');
} else {
Logger.log('The user clicked the close button in the dialog\'s title bar.');
}
我期望发生什么,而不是发生什么事情
我希望用户界面显示一个带有标题,消息,输入字段以及“是”和“否”按钮的对话框。用户还可以通过单击其标题栏中的关闭按钮来关闭对话框。
但是,什么也没发生。
复制步骤。
- 打开Google表格。
- 打开脚本编辑器:工具>脚本编辑器
- 将上述代码粘贴到脚本编辑器中。
- 关闭脚本编辑器。
- 导航到Google表格。
但是正如我提到的,实际上什么也没发生。
如何触发UI实例启动?我在做什么错了?