如果B列的值为0,则B列是我正在测试的值,C列是我要向其发送电子邮件的电子邮件。该函数运行但不发送电子邮件
function email() {
var ss = SpreadsheetApp.getActive().getSheetByName('email');
var range = ss.getRange('B1:B29');
var email = ss.getRange('C1:C29');
for (var i = 0; i < range.length; i++){
var recipient = email[i]
var x = range[i]
if(x == 0){
MailApp.sendEmail(recipient,
"Fill in Schedule for next Week",
"Your Schedule for next week isn't filled out. Please fill this in by Sunday\n https://docs.google.com/spreadsheets/d/1Yo8neePMv5rB-JRvgFOL6SKo83jv-FBoNuldcSynsUY/edit#gid=0 \n(Automated Message)",
{noReply:true});
}
}
}
答案 0 :(得分:0)
我知道了。我只需要使用.getValues()将变量转换为正确的数组
var range = ss.getRange('B1:B29').getValues();
var email = ss.getRange('C1:C29').getValues();