Google script trigger to run only on Monday/Wednesday/Friday
up vote
0
down vote
favorite
I'm running a SendEmail script with a 3 triggers to be sent out on Mondays, Wednesdays and Fridays.
I have 10 sheets on the spreadsheet (each one contains an SentEmail script and each needs to be sent out on those days but I have only 20 trigger limitation)
This is the code:
function sendEmail() {
var s = SpreadsheetApp.getActive().getSheetByName('BCX');
var ss = SpreadsheetApp.getActiveSpreadsheet();
var range = ss.getActiveSheet().getDataRange();
var range = s.getRange('B5:Q20');
var row = ss.getSheetByName('BCX').getRange("J1").getValue();
var to = "info@google.com";
var body = '';
var htmlTable = SheetConverter2.convertRange2html(range);
var body = "Hi Team!"
+ htmlTable
+ "<br/><br/><b><i>**This is an automated email**</i></b><br/><br/>Any question please let me know.<br/><br/>Regards,<br/><br/>";
var subject = "Google | Report " + row;
MailApp.sendEmail(to, subject, body, {htmlBody: body});
};
But if I use something like the following script it will create 3 triggers each week until it reaches 20 triggers (trigger limit).
function createTriggers() {
var days = [ScriptApp.WeekDay.MONDAY,
ScriptApp.WeekDay.WEDNESDAY,
ScriptApp.WeekDay.FRIDAY];
for (var i=0; i<days.length; i++) {
ScriptApp.newTrigger("sendEmail")
.timeBased().onWeekDay(days[i])
.atHour(7).create();
}
};
javascript google-apps-script google-sheets
|
show 5 more comments
up vote
0
down vote
favorite
I'm running a SendEmail script with a 3 triggers to be sent out on Mondays, Wednesdays and Fridays.
I have 10 sheets on the spreadsheet (each one contains an SentEmail script and each needs to be sent out on those days but I have only 20 trigger limitation)
This is the code:
function sendEmail() {
var s = SpreadsheetApp.getActive().getSheetByName('BCX');
var ss = SpreadsheetApp.getActiveSpreadsheet();
var range = ss.getActiveSheet().getDataRange();
var range = s.getRange('B5:Q20');
var row = ss.getSheetByName('BCX').getRange("J1").getValue();
var to = "info@google.com";
var body = '';
var htmlTable = SheetConverter2.convertRange2html(range);
var body = "Hi Team!"
+ htmlTable
+ "<br/><br/><b><i>**This is an automated email**</i></b><br/><br/>Any question please let me know.<br/><br/>Regards,<br/><br/>";
var subject = "Google | Report " + row;
MailApp.sendEmail(to, subject, body, {htmlBody: body});
};
But if I use something like the following script it will create 3 triggers each week until it reaches 20 triggers (trigger limit).
function createTriggers() {
var days = [ScriptApp.WeekDay.MONDAY,
ScriptApp.WeekDay.WEDNESDAY,
ScriptApp.WeekDay.FRIDAY];
for (var i=0; i<days.length; i++) {
ScriptApp.newTrigger("sendEmail")
.timeBased().onWeekDay(days[i])
.atHour(7).create();
}
};
javascript google-apps-script google-sheets
1
I cannot understand the logic ofBut if I use something like the following script it will create 3 triggers each week until it reaches 20 triggers (trigger limit).
. When yourcreateTriggers()
is run, 3 triggers are created for runningsendEmail
every Monday, Wednesday and Friday as "Week timer". I think that whencreateTriggers()
was run once, such trigger can be created. If I misunderstand your question, please tell me.
– Tanaike
Nov 19 at 23:45
I need the first script to run on Mondays, Wednesdays and Fridays for 10 sheets, that means 10 SendEmail scripts + 1 trigger for each day for each SendEmail script which trigger limitations doesnt allow more than 20
– Juan Pablo Marroquin Ocampo
Nov 21 at 17:56
I'm sorry for my poor English skill. I couldn't understand about what you want to do. You use 10 sheets in one Spreadsheet? Or you use 10 Spreadsheets? It seems that your script uses one sheet in one Spreadsheet. So can you update your question by including the detail information of the logic? Because in your question, By this, I think that it will help users understand your issue and think of your solution.
– Tanaike
Nov 21 at 23:36
Thank you Tanaike I have edited the question and yes, I have 10 sheets on the spreadsheet (each one contains an SentEmail script and each needs to be sent out on those days but I have only 20 trigger limitation)
– Juan Pablo Marroquin Ocampo
Nov 23 at 0:58
Thank you for updating it. When you use 10 sheets in one Spreadsheet, I think that you can run a trigger by scanning each sheet. So I cannot understand the logic ofeach one contains an SentEmail script and each needs to be sent out on those days but I have only 20 trigger limitation
. Can you explain about the detail of it? If my understanding of your situation is not correct, please tell me.
– Tanaike
Nov 23 at 2:21
|
show 5 more comments
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'm running a SendEmail script with a 3 triggers to be sent out on Mondays, Wednesdays and Fridays.
I have 10 sheets on the spreadsheet (each one contains an SentEmail script and each needs to be sent out on those days but I have only 20 trigger limitation)
This is the code:
function sendEmail() {
var s = SpreadsheetApp.getActive().getSheetByName('BCX');
var ss = SpreadsheetApp.getActiveSpreadsheet();
var range = ss.getActiveSheet().getDataRange();
var range = s.getRange('B5:Q20');
var row = ss.getSheetByName('BCX').getRange("J1").getValue();
var to = "info@google.com";
var body = '';
var htmlTable = SheetConverter2.convertRange2html(range);
var body = "Hi Team!"
+ htmlTable
+ "<br/><br/><b><i>**This is an automated email**</i></b><br/><br/>Any question please let me know.<br/><br/>Regards,<br/><br/>";
var subject = "Google | Report " + row;
MailApp.sendEmail(to, subject, body, {htmlBody: body});
};
But if I use something like the following script it will create 3 triggers each week until it reaches 20 triggers (trigger limit).
function createTriggers() {
var days = [ScriptApp.WeekDay.MONDAY,
ScriptApp.WeekDay.WEDNESDAY,
ScriptApp.WeekDay.FRIDAY];
for (var i=0; i<days.length; i++) {
ScriptApp.newTrigger("sendEmail")
.timeBased().onWeekDay(days[i])
.atHour(7).create();
}
};
javascript google-apps-script google-sheets
I'm running a SendEmail script with a 3 triggers to be sent out on Mondays, Wednesdays and Fridays.
I have 10 sheets on the spreadsheet (each one contains an SentEmail script and each needs to be sent out on those days but I have only 20 trigger limitation)
This is the code:
function sendEmail() {
var s = SpreadsheetApp.getActive().getSheetByName('BCX');
var ss = SpreadsheetApp.getActiveSpreadsheet();
var range = ss.getActiveSheet().getDataRange();
var range = s.getRange('B5:Q20');
var row = ss.getSheetByName('BCX').getRange("J1").getValue();
var to = "info@google.com";
var body = '';
var htmlTable = SheetConverter2.convertRange2html(range);
var body = "Hi Team!"
+ htmlTable
+ "<br/><br/><b><i>**This is an automated email**</i></b><br/><br/>Any question please let me know.<br/><br/>Regards,<br/><br/>";
var subject = "Google | Report " + row;
MailApp.sendEmail(to, subject, body, {htmlBody: body});
};
But if I use something like the following script it will create 3 triggers each week until it reaches 20 triggers (trigger limit).
function createTriggers() {
var days = [ScriptApp.WeekDay.MONDAY,
ScriptApp.WeekDay.WEDNESDAY,
ScriptApp.WeekDay.FRIDAY];
for (var i=0; i<days.length; i++) {
ScriptApp.newTrigger("sendEmail")
.timeBased().onWeekDay(days[i])
.atHour(7).create();
}
};
javascript google-apps-script google-sheets
javascript google-apps-script google-sheets
edited Nov 23 at 0:57
asked Nov 19 at 22:56
Juan Pablo Marroquin Ocampo
156
156
1
I cannot understand the logic ofBut if I use something like the following script it will create 3 triggers each week until it reaches 20 triggers (trigger limit).
. When yourcreateTriggers()
is run, 3 triggers are created for runningsendEmail
every Monday, Wednesday and Friday as "Week timer". I think that whencreateTriggers()
was run once, such trigger can be created. If I misunderstand your question, please tell me.
– Tanaike
Nov 19 at 23:45
I need the first script to run on Mondays, Wednesdays and Fridays for 10 sheets, that means 10 SendEmail scripts + 1 trigger for each day for each SendEmail script which trigger limitations doesnt allow more than 20
– Juan Pablo Marroquin Ocampo
Nov 21 at 17:56
I'm sorry for my poor English skill. I couldn't understand about what you want to do. You use 10 sheets in one Spreadsheet? Or you use 10 Spreadsheets? It seems that your script uses one sheet in one Spreadsheet. So can you update your question by including the detail information of the logic? Because in your question, By this, I think that it will help users understand your issue and think of your solution.
– Tanaike
Nov 21 at 23:36
Thank you Tanaike I have edited the question and yes, I have 10 sheets on the spreadsheet (each one contains an SentEmail script and each needs to be sent out on those days but I have only 20 trigger limitation)
– Juan Pablo Marroquin Ocampo
Nov 23 at 0:58
Thank you for updating it. When you use 10 sheets in one Spreadsheet, I think that you can run a trigger by scanning each sheet. So I cannot understand the logic ofeach one contains an SentEmail script and each needs to be sent out on those days but I have only 20 trigger limitation
. Can you explain about the detail of it? If my understanding of your situation is not correct, please tell me.
– Tanaike
Nov 23 at 2:21
|
show 5 more comments
1
I cannot understand the logic ofBut if I use something like the following script it will create 3 triggers each week until it reaches 20 triggers (trigger limit).
. When yourcreateTriggers()
is run, 3 triggers are created for runningsendEmail
every Monday, Wednesday and Friday as "Week timer". I think that whencreateTriggers()
was run once, such trigger can be created. If I misunderstand your question, please tell me.
– Tanaike
Nov 19 at 23:45
I need the first script to run on Mondays, Wednesdays and Fridays for 10 sheets, that means 10 SendEmail scripts + 1 trigger for each day for each SendEmail script which trigger limitations doesnt allow more than 20
– Juan Pablo Marroquin Ocampo
Nov 21 at 17:56
I'm sorry for my poor English skill. I couldn't understand about what you want to do. You use 10 sheets in one Spreadsheet? Or you use 10 Spreadsheets? It seems that your script uses one sheet in one Spreadsheet. So can you update your question by including the detail information of the logic? Because in your question, By this, I think that it will help users understand your issue and think of your solution.
– Tanaike
Nov 21 at 23:36
Thank you Tanaike I have edited the question and yes, I have 10 sheets on the spreadsheet (each one contains an SentEmail script and each needs to be sent out on those days but I have only 20 trigger limitation)
– Juan Pablo Marroquin Ocampo
Nov 23 at 0:58
Thank you for updating it. When you use 10 sheets in one Spreadsheet, I think that you can run a trigger by scanning each sheet. So I cannot understand the logic ofeach one contains an SentEmail script and each needs to be sent out on those days but I have only 20 trigger limitation
. Can you explain about the detail of it? If my understanding of your situation is not correct, please tell me.
– Tanaike
Nov 23 at 2:21
1
1
I cannot understand the logic of
But if I use something like the following script it will create 3 triggers each week until it reaches 20 triggers (trigger limit).
. When your createTriggers()
is run, 3 triggers are created for running sendEmail
every Monday, Wednesday and Friday as "Week timer". I think that when createTriggers()
was run once, such trigger can be created. If I misunderstand your question, please tell me.– Tanaike
Nov 19 at 23:45
I cannot understand the logic of
But if I use something like the following script it will create 3 triggers each week until it reaches 20 triggers (trigger limit).
. When your createTriggers()
is run, 3 triggers are created for running sendEmail
every Monday, Wednesday and Friday as "Week timer". I think that when createTriggers()
was run once, such trigger can be created. If I misunderstand your question, please tell me.– Tanaike
Nov 19 at 23:45
I need the first script to run on Mondays, Wednesdays and Fridays for 10 sheets, that means 10 SendEmail scripts + 1 trigger for each day for each SendEmail script which trigger limitations doesnt allow more than 20
– Juan Pablo Marroquin Ocampo
Nov 21 at 17:56
I need the first script to run on Mondays, Wednesdays and Fridays for 10 sheets, that means 10 SendEmail scripts + 1 trigger for each day for each SendEmail script which trigger limitations doesnt allow more than 20
– Juan Pablo Marroquin Ocampo
Nov 21 at 17:56
I'm sorry for my poor English skill. I couldn't understand about what you want to do. You use 10 sheets in one Spreadsheet? Or you use 10 Spreadsheets? It seems that your script uses one sheet in one Spreadsheet. So can you update your question by including the detail information of the logic? Because in your question, By this, I think that it will help users understand your issue and think of your solution.
– Tanaike
Nov 21 at 23:36
I'm sorry for my poor English skill. I couldn't understand about what you want to do. You use 10 sheets in one Spreadsheet? Or you use 10 Spreadsheets? It seems that your script uses one sheet in one Spreadsheet. So can you update your question by including the detail information of the logic? Because in your question, By this, I think that it will help users understand your issue and think of your solution.
– Tanaike
Nov 21 at 23:36
Thank you Tanaike I have edited the question and yes, I have 10 sheets on the spreadsheet (each one contains an SentEmail script and each needs to be sent out on those days but I have only 20 trigger limitation)
– Juan Pablo Marroquin Ocampo
Nov 23 at 0:58
Thank you Tanaike I have edited the question and yes, I have 10 sheets on the spreadsheet (each one contains an SentEmail script and each needs to be sent out on those days but I have only 20 trigger limitation)
– Juan Pablo Marroquin Ocampo
Nov 23 at 0:58
Thank you for updating it. When you use 10 sheets in one Spreadsheet, I think that you can run a trigger by scanning each sheet. So I cannot understand the logic of
each one contains an SentEmail script and each needs to be sent out on those days but I have only 20 trigger limitation
. Can you explain about the detail of it? If my understanding of your situation is not correct, please tell me.– Tanaike
Nov 23 at 2:21
Thank you for updating it. When you use 10 sheets in one Spreadsheet, I think that you can run a trigger by scanning each sheet. So I cannot understand the logic of
each one contains an SentEmail script and each needs to be sent out on those days but I have only 20 trigger limitation
. Can you explain about the detail of it? If my understanding of your situation is not correct, please tell me.– Tanaike
Nov 23 at 2:21
|
show 5 more comments
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53383834%2fgoogle-script-trigger-to-run-only-on-monday-wednesday-friday%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
I cannot understand the logic of
But if I use something like the following script it will create 3 triggers each week until it reaches 20 triggers (trigger limit).
. When yourcreateTriggers()
is run, 3 triggers are created for runningsendEmail
every Monday, Wednesday and Friday as "Week timer". I think that whencreateTriggers()
was run once, such trigger can be created. If I misunderstand your question, please tell me.– Tanaike
Nov 19 at 23:45
I need the first script to run on Mondays, Wednesdays and Fridays for 10 sheets, that means 10 SendEmail scripts + 1 trigger for each day for each SendEmail script which trigger limitations doesnt allow more than 20
– Juan Pablo Marroquin Ocampo
Nov 21 at 17:56
I'm sorry for my poor English skill. I couldn't understand about what you want to do. You use 10 sheets in one Spreadsheet? Or you use 10 Spreadsheets? It seems that your script uses one sheet in one Spreadsheet. So can you update your question by including the detail information of the logic? Because in your question, By this, I think that it will help users understand your issue and think of your solution.
– Tanaike
Nov 21 at 23:36
Thank you Tanaike I have edited the question and yes, I have 10 sheets on the spreadsheet (each one contains an SentEmail script and each needs to be sent out on those days but I have only 20 trigger limitation)
– Juan Pablo Marroquin Ocampo
Nov 23 at 0:58
Thank you for updating it. When you use 10 sheets in one Spreadsheet, I think that you can run a trigger by scanning each sheet. So I cannot understand the logic of
each one contains an SentEmail script and each needs to be sent out on those days but I have only 20 trigger limitation
. Can you explain about the detail of it? If my understanding of your situation is not correct, please tell me.– Tanaike
Nov 23 at 2:21