I am trying to get a script going that takes in the date of a cell, compares it to today, and runs if the difference is 4 days. I am not sure how to get the if statement to work. Currently it will send emails, but it will not check if the statement is correct. I am not sure how to incorporate it into the sheet.
So looking at my code so far,
var checkStatus = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Responses").getRange("K:K");
var status = checkStatus.getValue();*
var formattedDate = Utilities.formatDate(new Date(), "GMT-4", "MM-dd-yyyy");
if(status != "closed" && "NEED THIS TO BE DATE OF ENTRY" > (today+4)'{*
var emailRange = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Data").getRange("A1");
var emailAddress = emailRange.getValue();
var message = 'It looks like there is a ticket that has not yet been closed in your sheet. Please check the sheet and ensure all customers are taken care of!'
var subject = 'Tech Support Ticket Over-Due';
MailApp.sendEmail(emailAddress, subject, message);
}
}
Basically, I want it to email me if there are any dates in column A that are older than 4 days and do not carry the status of "Closed" in column L.