Google Sheets Apps Script to copy (GoogleFinance) data archive via appendRow

102 Views Asked by At

I'm using in Sheets the GoogleFinance-API to get the current $/€ exchange course. I'm archiving this data via an apps script - reading out the fields and writing those back in the sheet using appendRow - for testing purposes I did it on a minute interval... It worked for about 10 rows - after this it writes instead of the stock-exchange value a date '30.12.1899 23:41:33' in the field (the logs in apps scripts are fin though) - have no clue where it comes from and what I'm doing wrong here - please have a look at the screen grabs

 function saveData() {
  var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet1");
  var data = sheet.getRange(5,1,1,2).getValues();
  var time = data[0][0];
  var stock = data[0][1];
  Logger.log(time+" ::: "+stock);
  sheet.appendRow(data[0]);
  Logger.log(data);
}

just added the images here - stackoverflow is not very intuitive for 1st time users.

0

There are 0 best solutions below