Trying to add a confirmation dialog when a user clicks a menu item, I am following this Google page almost to the letter: https://developers.google.com/apps-script/guides/dialogs#alert_dialogs
However, I am getting a "This operation is not supported" error message. In the Execution Transcript, I see this:
[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]
Line 28 in "Code" is the second line of the function below:
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());
};
Thank you!
This code is for the new version of spreadsheets, did you upgrade to new version ?
(just tested and works without issue)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With