I'm exploring Google App Scripts and working on a spreadsheet that has three columns: name, overdue, and last contacted. You can view the spreadsheet here.
My goal is to send myself an email reminder containing the names of individuals marked as overdue in column B.
Currently, I've managed to create a script that sends an email for row 2 only. I'm struggling to figure out how to loop through the values in column B.
Below is my script:
function sendEmail() {
var overdueRange = SpreadsheetApp.getActiveSpreadsheet().getRange("B2");
var overdueValue = overdueRange.getValue();
if (overdueValue === "Overdue") {
var nameRange = SpreadsheetApp.getActiveSpreadsheet().getRange("A2");
var name = nameRange.getValues();
var message = 'Reach out to ' + name;
var subject = 'Reach out to this person.';
MailApp.sendEmail('<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ee83978b838f8782ae8b838f8782c08d8183">[email protected]</a>', subject, message);
}
}
sendEmail()