I have a macro to run at the beginning of every day which inserts today's date, grabs the previous day's data inputs, pastes them below today's date, and then formats it all. The issue is that I need it to display yesterday's date, not today's, and I need it to remain that date over time.
I've searched all over for solutions to this issue, but I can't find anything that answers my issue. Maybe I'm just bad at searching. This is what the code in question currently is:
function MorningRoutine() {
var spreadsheet = SpreadsheetApp.getActive();
var date = new Date();
spreadsheet.getActiveRangeList().setValue(date);
I need the macro to input yesterday's date, but this currently displays today's.
This will give yesterday date:
function MorningRoutine() {
var spreadsheet = SpreadsheetApp.getActive();
var date = new Date();
date.setDate(d.getDate()-1);
spreadsheet.getActiveRangeList().setValue(date);
}