我有一个很好的谷歌应用程序脚本,工作正常,但它导致删除我的谷歌电子表格中的工作表因此我希望脚本以是/否提示开始询问“你确定要关闭工作”。如果他说是,那么,继续,如果没有,退出剧本。
有什么想法吗?提前谢谢!
答案 0 :(得分:2)
找到了这个
// Display a dialog box with a message 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.alert('Are you sure you want to continue?',
ui.ButtonSet.YES_NO);
// Process the user's response.
if (response == ui.Button.YES) {
Logger.log('The user clicked "Yes."');
} else {
Logger.log('The user clicked "No" or the close button in the dialog\'s
title bar.');
}