Skip to content

Instantly share code, notes, and snippets.

@tanshio
Last active January 14, 2019 10:10
Show Gist options
  • Save tanshio/77e21a7c03fb2a09f21c to your computer and use it in GitHub Desktop.
Save tanshio/77e21a7c03fb2a09f21c to your computer and use it in GitHub Desktop.
gas trigger
//https://groups.google.com/forum/#!msg/google-apps-api-japan/sbXlShVOGiw/9Bl3i1s1ch8J
function deleteTrigger(triggerKey) {
triggerKey = triggerKey || "triggerId";
// ああああああああ
var triggerId = ScriptProperties.getProperty(triggerKey);
if(!triggerId) {
return;
}
ScriptApp.getScriptTriggers().filter(function(trigger){
//var trigger = ScriptApp.getScriptTriggers()[0];
return trigger.getUniqueId() == triggerId;
})
.forEach(function(trigger) {
ScriptApp.deleteTrigger(trigger);
});
ScriptProperties.deleteProperty(triggerKey);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment