Reputation: 1567
I have a critical business spreadsheet. I need to save copies regularly in case I need to see how the spreadsheet looked at a previous time.
I want this to happen automatically using Google Apps Script.
Upvotes: 0
Views: 791
Reputation: 1567
Use the time driven triggers to run this code:
function backupSheet() {
var file = DriveApp.getFileById(FILE_ID);
var destination = DriveApp.getFolderById(FOLDER_ID); // backups folder
var date = new Date();
var ts = date.toISOString().slice(0,10).replace(/-/g,"");
file.makeCopy(ts+':'+file.getName(), destination);
}
Upvotes: 1