Google SpreadSheets - When using a time trigger in code, some cells getting '#N/A' value

Posted by Robi on Stack Overflow See other posts from Stack Overflow or by Robi
Published on 2013-10-15T06:00:12Z Indexed on 2013/10/18 9:55 UTC
Read the original article Hit count: 253

I've created a Google spreadsheet with imported data on one cell, extracting specific string to another cell and pasting the data in a table with a trigger for every 2 hours. Now everything works perfectly when running the script manually but when logged out and waiting for the cells to fill, sometimes the pasted cell getting "#N/A" value. Here is the code I'm using:

function PasteV(){
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = ss.getSheets()[0];
  var timestamp= sheet.getRange("D1").getValue();
  var sale= sheet.getRange("G1").getValue();
  var rent= sheet.getRange("J1").getValue();
  sheet.appendRow([timestamp, rent, sale]);
}

Again when running manually countless times - no problem. I'll appreciate your help. Thanks.

© Stack Overflow or respective owner

Related posts about google-apps-script

Related posts about google-spreadsheet