I have a basic script that I found works pretty good for my needs. The file I want to copy gets updated once a day. The person that updates it just overwrites the file every day so I'm trying to store a historical copy of the file, into a folder on my drive. The script below does copy the file and creates the file for me. However I am trying to polish up a few things.
function DailyPerformanceCopy() {
ScriptApp.newTrigger('DailyPerformanceTrigger')
.forSpreadsheet('ENTERSPREADSHEETIDHERE')
.onEdit()
.create();
var date = new Date();
Logger.log(Utilities.formatDate(date,'America/Chicago', 'MMMM dd, yyyy'));
var ss = SpreadsheetApp.openById("ENTERSPREADSHEETIDHERE");
//Make a copy of the template file
var documentId = DriveApp.getFileById('ENTERSPREADSHEETIDHERE').makeCopy().getId();
//Rename the copied file
DriveApp.getFileById(documentId).setName('Performance ' + date);
}
- I would like the copied file to only be saved as Performance + The current Month, Date, Year. (Performance March 16 2020. Tomorrows copy to be saved as Performance March 17 2020, etc)
Its currently being saved as: Performance Mon Mar 16 2020 14:45:09 GMT-0400 (Eastern Daylight Time)
Its currently being saved to the root of my drive. I'd like it to be saved to the folder I created called "Performance"
Im not sure if it will execute tomorrow after the file gets updated. Im assuming so?