I have a data sheet that will update weekly. I would like a script to copy the sheet and rename it with the current date. The goal is to preserve the data in the sheet weekly before it updates so that I have a record of the data. This is the script that I have so far:
/** @OnlyCurrentDoc */function myFunction() {
let sh, temp_one_values;
sh = SpreadsheetApp.getActive();
temp_one_values = transpose_(sh.getSheetByName('Complete Tutoring Roster').getRange('A1:Z1000').getValues());
{temp_one.copyTo(sh).setName(szToday);
}
}
function transpose_(array) {
return Object.keys(array[0]).map(function (col) {
return array.map(function (row) {
return row[col];
});
});
}
function CopyDataSheet() {
var spreadsheet = SpreadsheetApp.getActive();
spreadsheet.getRange('A1').activate();
spreadsheet.duplicateActiveSheet();
spreadsheet.getActiveSheet().setName('11/19/2020');
};
I used record a macro to get the script.
I know that I need to edit the setName code. But I am not sure how to code it to pull the current date.