March 2016
Beginner to intermediate
232 pages
4h 29m
English
You can create or delete triggers programmatically as shown in the following sample code:
/**
* Deletes all the triggers.
*
*/
function deleteTriggers(){
var triggers = ScriptApp.getProjectTriggers();
triggers.forEach(function(trigger){
try{
ScriptApp.deleteTrigger(trigger);
} catch(e) {
throw e.message;
};
Utilities.sleep(1000);
});
};
function createTrigger(){
var ss = SpreadsheetApp.getActiveSpreadsheet();
// Create new trigger
ScriptApp.newTrigger("sendEmail")
.forSpreadsheet(ss).onFormSubmit().create();
};In the
deleteTriggers function, the Utilities service's sleep method is used to pause the script temporarily for the specified milliseconds. Otherwise, you may experience the Too many service ...
Read now
Unlock full access