- Simple Trigger
- Installable Triggers
Simple Trigger are used 6 reserved functions, when a user opens the spread sheet,forms, slides and docs, then we can use any one of thes
e reserved function to trigger the any thing. Actually we can manage the triggers in Programmatically and Manually
e reserved function to trigger the any thing. Actually we can manage the triggers in Programmatically and Manually
The 6 Reserved Triggers functions are
- onOpen(e)
- onEdit(e)
- onSelectionChange(e)
- onInstall(e)
- doGet(e)
- doPost(e)
Below is the simple triggers syntax
------------------------------onInstall-------------------------
function onInstall(e) {
onInstall(e)
}
---------------------------------onOpen------------------------
function onOpen(e) {
onOpen(e);
}
--------------------------------onEdit---------------------------
function onEdit(e) {
onEdit(e)
}
-----------------------------------onOpen------------------------
function onOpen(e) {
onOpen(e);
}
-------------------------------------------------------------------- |
---|
below is the simple source code for simple triggers without reserved functions.
/** * Trigger in Hours. */ function createHoursBasedAndDayBased() { // Trigger every 12 hours. ScriptApp.newTrigger('sendEmailsBasedOnTriggers') .timeBased() .everyHours(12) .create(); // Trigger every THURSDAY at 12:00. ScriptApp.newTrigger('sendEmailsBasedOnTriggers') .timeBased() .onWeekDay(ScriptApp.WeekDay.THURSDAY) .atHour(12) .create(); } This is other function-------------------------------------------------------> /** * Sends emails with initialized values. */ function sendEmailsBasedOnTriggers() { var emailAddress = "alltechgeekz@gmil.com"; // First column var message ="This is Trigger messged testing alltech geeks"]; // Second column var subject = 'Google Apps Script Time Based Trigger Date and Time'; MailApp.sendEmail(emailAddress, subject, message); } |
---|
Post a Comment (0)