简体   繁体   中英

How to archive data with google scripts

I'm new to writing scripts and am attempting to get started on archiving my data. Right now I have this script, which I thought was a good start, but am getting an error when I attempt to run it.

On the sheet named "Allergen Planner" I have a live CSS feed in cell N17 which updates every hour. I am attempting to archive that data once daily and place it in a new sheet called "Archived data". I've tried looking into researching on my own for some time now, but am struggling to find something that can help. Everything I've found is way above my capabilities. Is there anything I can edit in my script which would achieve what I'm looking for? Any help would be greatly appreciated.

{

var ssA = SpreadsheetApp.openById('1ji3Q02uOyrDXyrl7LcghWLcLjz-CeSUgSCU7QD0BVEk');
var sheetA = ssA.getSheetByName('Allergen Planner');
var dataToMove = sheetA.getRange(14,17,sheetA.getLastRow(),sheetA.getLastColumn()).getValues();
var ssB = SpreadsheetApp.openById('1ji3Q02uOyrDXyrl7LcghWLcLjz-CeSUgSCU7QD0BVEk'); 
var sheetB = ssB.getSheetByName('Archived Data');
dataToMove.forEach(function(elts){
sheetB.appendRow(elts)
});


}

The code pasted above worked. If you receive a red "Unkown error occurred" message in the execution log, reboot the script app and try again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM