I'm working on a Google spreadsheet that is edited by multiple people. It's to track various member stats, so they each only update one row. What I am trying to do is check when a cell in the row is updated, and change the background of another cell in that row depending on the date of the update.
function onEdit() {
var s = SpreadsheetApp.getActiveSheet();
if( s.getName() == "HT ~ Stats" ) { //checks that we're on the correct sheet
var r = s.getActiveCell();
if( r.getColumn() == 7 ) { //checks for the correct column
var dateCell = r.offset(0,21);
//var date = new Date()
var date = Utilities.formatDate(new Date(), "GMT", "MM-dd-yyyy")
dateCell.setValue(date); //sets column AB of selected row to the date of the update
};
}
It's at this point where I'm getting stuck. What I want to happen after this point is for the value of the var date to get compared to the current date. Once it gets compared, if the result is within 3 days of the current date, I want the first cell in the selected row to have it's background changed to green.
This is my first time ever doing anything in Google Scripts, so I'm sure there is any easier or better way to do this. Thanks for any help :)