I wrote a simple script trying to programmatically create a script from the onEdit function
function onEdit() {
test();
}
function test() {
triggerLater();
}
function customMsgBox() {
Browser.msgBox("hello world");
}
function triggerLater() {
var date = new Date();
date.setMinutes(date.getMinutes() + 1);
try {
var oneTimeOnly = ScriptApp.newTrigger("customMsgBox")
.timeBased()
.at(date)
.create();
return oneTimeOnly.getUniqueId();
}
catch (e) {
var ss = SpreadsheetApp.getActiveSpreadsheet();
ss.toast("error");
}
}
If I try to run onEdit from the script editor the trigger is created but every edit on the spreadsheet get a "error" message in a toast
Can someone help me to understand ?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…