0

I am new to google app scripts and I have been looking for a way to back up a sheet. I am currently using.

DriveApp.getFileById("146qFnrQoNPBcDhV6QB0bscHFp8TquXJoAC1qg‌​_esy4E").makeCopy("D‌​ailyArchive" + Date() + " backup");

The problem is its making a daily backup and those backups are updating just like the original and I just want to make a backup of the values so I have a archive. In my sheet I am importing data from a jail roster. http://www.kitsapgov.com/sheriff/incustody/jailwebname.xml

user5249
  • 1
  • 1

1 Answers1

0

Here something quite simple for one sheet (you can adapt it for several sheets)

  var source = SpreadsheetApp.getActiveSpreadsheet();
  var data = source.getActiveSheet().getDataRange();
  var cible = SpreadsheetApp.create(source.getName()+" backup");
  cible.getActiveSheet().getRange(data.getA1Notation()).setValues(data.getValues());
  Logger.log(cible.getId());
  Logger.log(cible.getUrl());
Harold
  • 3,297
  • 1
  • 18
  • 26