There is a question on my form that, when one of the two options is chosen, will email the contents of the form to one of two people, based on the response. I haven't been able to find a code that can do this. Any help would be appreciated.
Here's the code:
function battlingEmails()
{
var ss=SpreadsheetApp.getActiveSpreadsheet();
var sht=ss.getSheetByName('EmailDest');
var rng=sht.getDataRange();
var rngA=rng.getValues();
for(var i=1;i<rngA.length;i++)
{
if(!rngA[i][5])
{
MailApp.sendEmail(rngA[i][rngA[i][2]-1], rngA[i][3], rngA[i][4])
//Logger.log('Email: ' + rngA[i][rngA[i][2]-1] + 'Option: ' + rngA[i][2] + 'Subject: ' + rngA[i][3] + 'Body: ' + rngA[i][4]);
sht.getRange(i+1,6).setValue(Utilities.formatDate(new Date(), "GMT-6", "dd/MM/yyyy HH:mm:ss"));
}
}
SpreadsheetApp.flush();
}
My vision of the sheet:
The Email Notification for Google Forms add-on lets you send email notifications to different recipients based on form answers. (I am the author of this Google addon)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.