gpt4 book ai didi

google-apps-script - 不支持 SpreadsheetApp.getUi() 操作?

转载 作者:行者123 更新时间:2023-12-05 00:04:25 24 4
gpt4 key购买 nike

试图在用户单击菜单项时添加确认对话框,我几乎完全按照这个 Google 页面进行操作:https://developers.google.com/apps-script/guides/dialogs#alert_dialogs

但是,我收到“不支持此操作”的错误消息。在执行记录中,我看到了这个:

[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());
};

谢谢!

最佳答案

此代码适用于 new version of spreadsheets ,你升级到新版本了吗?

(刚刚测试,没有问题)

关于google-apps-script - 不支持 SpreadsheetApp.getUi() 操作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21684229/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com