I have repurposed this Google Sheet with script linked below:
https://docs.google.com/spreadsheets/d/1z1EfLPYRze0zWnk729ChCf_kOY-JPEV9dvjCbXHNZDc/edit?usp=sharing
Someone had previously shared this and I have tried to tweak it for my needs. It works fine for sending email reminders based on when "Date to send" becomes current. There's just a little something that I need it to do but I can't figure out as I've no experience with scripting/code.
I would like to write the script that needs to be added to my current script to do the following:
When script run on sheet daily based on trigger- and sends out email reminders for specific rows - it should update column1 of those rows with a new date- essentially advancing the existing date by the number of days in column 5 (Days to next reminder). ((Eg- Row 6 has date Feb 7,2020 - after email reminder is shot- it must add 180 days (Col 5 data) to Feb 7 and update Col 1 with new Date as Aug 5, 2020; So the sheet is ready to send the next reminder then. If Col 5 reads 0- then it should not update that date and just leave the row as it is.
And simultaneously in Col 6 - it should update not just "Email sent" but with added info "on this day" which is the date the email is sent out.
And finally the sheet should be sorted with - latest and highest date in col 1 rows - at the top and least date at the bottom.
I came up with this additional code but since I don't know any syntax, it's not working:
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getActiveSheet();
//Get the dates from the cell and convert them into Milliseconds since 1970/01/01
var First = new Date(ss.getRange(row[1]).getValue().getTime();
var dayInMs = 24*60*60*1000 //one day in Milliseconds
//add row days to each date in milliseconds
First = First + ((row[4])*dayInMs)
//Convert Milliseconds to date use new Date(time in ms) and set Values of the cell
ss.getRange(row[1]).setValue(new Date(First));
How can I proceed?