当用户点击菜单项时尝试添加确认对话框,我正在关注此Google页面几乎写到:https://developers.google.com/apps-script/guides/dialogs#alert_dialogs
但是,我收到“不支持此操作”错误消息。在Execution Transcript中,我看到了:
[14-02-10 12:21:54:551 EST] Starting execution
[14-02-10 12:21:55:550 EST] Execution failed: This operation is not supported (line 28, file "Code") [0.226 seconds total runtime]
“代码”中的第28行是以下函数的第二行:
function sendMergedMail() {
var ui = SpreadsheetApp.getUi();
var result = ui.alert(
'Please confirm',
'Are you sure you want to continue?',
ui.ButtonSet.YES_NO);
if (result != ui.Button.YES) {
return
}
var doc = SpreadsheetApp.getActiveSpreadsheet();
doc.toast("Current sheet: "+doc.getName());
};
谢谢!