I'm trying to build a project tracker that would
- send an email to a list of emails
- the title of the email is the text from cell A1
- body of email is the text from cell D1
- the trigger is when the value of the cell E1 changes to either "Complete" or "Attention"
So far I've created a script to send emails to the list of people created in a specific sheet. But I'm struggling with the function OnEdit and how to link the cells in single row when sending the email. The spreadsheet will have a number of rows referring to different projects.
function sendEmails(){
var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Email");
var lr = ss.getLastRow();
for (var i = 2;i<=lr;i++){
var currentEmail = ss.getRange(i, 1).getValue();
var currentClassTitle = ss.getRange(i, 3).getValue();
MailApp.sendEmail(currentEmail,currentClassTitle,"Project complete");
}
}
Any help and suggestions are greatly appreciated.
onEdittrigger to check if a cell in column E is changed to "Complete" or "Attention" to send an email with the data from the corresponding row? - ross