title: How To Use an Apps Script To "Copy-PasteValue" Dynamic Data In a Google Spreadsheet at a given time?
body: <p>I have a google spreadsheet that imports and modifies data from an online source that updates every hour. I wish to pull a static copy of the 10pm update from the spreadsheet—essentially a copy-paste special at a certain time. I am using the following Script and set a Time-Driven trigger for 10pm.  The script pulls data from cells N5:N10 of one sheet (which update every hour) and pastes only static values into cells N5:N10 of a second sheet in the same spreadsheet.</p>
  
  <p><code>function PasteValue()}</code> <p>
  <code>var ss = SpreadsheetApp.getActiveSpreadsheet();</code><p>
  <code>var data= ss.getSheets()[1].getRange("N5:O10").getValues();</code><p>
  <code>ss.getSheets()[2].getRange("N5:O10").setValues(data);</code><p>
  <code>}</code><p></p>
  
  <p>When I run the script manually it works perfectly. However, when I set the Time-Driven trigger and close the sheet, all that is imported is a series of static “#######” when I check the next morning.</p>
  
  <p>Does anybody have any insight as to the problem? Or, if anybody has an alternative script or method to automatically copy-pastevalues in google spreadsheets using formulas or scripts, I would really appreciate it.</p>
  
  <p>Thanks,
  Ron</p>