I have the task of trying to automate a email where if two conditions are met, then send the email. I am mostly there.
Code is as follows:
function dateSender() {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("emails");
var Lastrow =sheet.getLastRow();
for (var i = 2;i<=Lastrow;i++){
var person = sheet.getRange(i,8).getValue();
var Emails = sheet.getRange(i,2).getValue();
var body = sheet.getRange(i,9).getValue();
var currentValue = sheet.getRange(i,3).getValue();
var Date = sheet.getRange(i,5).getValue();
if (currentValue == ("'Open'") && Date == today){
MailApp.sendEmail(Emails,person,body)
}
}
}
it works as far as the if cell is open then sends, but when I ad the date portion things don't send. I want it to be if the cell value is open, and the date is equal to today, then send the email.
Thanks in advance.