Skip to content

Instantly share code, notes, and snippets.

@pejantantangguh
Created December 18, 2018 01:33
Show Gist options
  • Save pejantantangguh/fe91d9ee124814e0477a2ce577e64345 to your computer and use it in GitHub Desktop.
Save pejantantangguh/fe91d9ee124814e0477a2ce577e64345 to your computer and use it in GitHub Desktop.
Backup Google Sheets Daily
//Credit Reserved to :
//Abhijeet Chopra
//26 February 2016
//URL : https://gist.github.com/abhijeetchopra/99a11fb6016a70287112
//~~ Herman 18122018
function makeCopy() {
//Time stamp generation. Storing variable in formatted date as days, dd-MM-YYY
const formattedDate = Utilities.formatDate(new Date(),"GMT+10:00", "EEE, d MMM yyyy");
//Get name of original file and appending date at the end as name.
const saveAs = "Copy "+ SpreadsheetApp.getActiveSpreadsheet().getName() + " " + formattedDate;
// Get folder destination by ID :
const destinationFolder = DriveApp.getFolderById("1iPMY2be4cSQe0J6W-Bkw8asA6RFP-PG6");
DriveApp.getFileById(SpreadsheetApp.getActiveSpreadsheet().getId()).makeCopy(saveAs, destinationFolder);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment