This tutorial demonstrates how to use Google Apps Script to:
-
Create copies of the Google Sheet in the desired destination folder automatically at set intervals.
-
Append the time stamp with each backup file's name.
-
Adjust time trigger for backing up every day/hour/minute.
I have copied this and substituted my folderid correctly, but it fails But when I execute it I get
ReferenceError: file is not defined
makeCopy @ Code.gs:20
I have modified this code thus:
var destination = DriveApp.getFolderById("1ksDmM2Ks_vPQZJANXaHgw5E3JHKX6IKl");
var file = DriveApp.getFileById(SpreadsheetApp.getActiveSpreadsheet().getId())
But when I run under the debugger, both these variables are shown as {...} which presumably means undefined. Why can't either of these IDs be found?
MH