title: google apps script - paste in next empty row
body: <p>with google apps script I am collecting data from the google analytics API.
  This is set to collect data every night 1 am for the previous day and writing that in to a sheet “original”</p>
  
  <p>In my second script I want to copy a range A1:G1 from the sheet “original” to my second sheet “copy”
  And what I want is continuously to copy the data to the next empty row, but how?</p>
  
  <p>So far I have this as a basic solution, but this is always pasting the selected data into the defined cell (in this case cell A10) </p>
  
  <pre><code>function copytestdata() {
  
    var ss = SpreadsheetApp.getActiveSpreadsheet();
    var sheet1 = ss.getSheetByName("original");
    var sheet2 = ss.getSheetByName("copy");
  
    sheet1.getRange("A1:G1").copyTo(sheet2.getRange("A10"), {contentsOnly:true});
  
   }
  </code></pre>
  
  <p>I would like a dynamic solution on the second sheet “copy”.
  So new data should be pasted in to the next empty row starting from cell A1 and the  go down to next empty row.
  But how do I get the script to go down to the next empty row?</p>
  
  <pre><code>sheet1.getRange("A1:G1").copyTo(sheet2.[DYNAMIC SOLUTION]), {contentsOnly:true});
  </code></pre>
  
  <p>Have anyone got a brilliant idea? I would really appreciate the help.</p>
  
  <p>Ohh and by the way how can I actually go to a specific cell sort of like:
      sheet1.getActiveRange(“B8”)</p>
  
  <p>Thanks a lot in advance for your help
  Pelikan76</p>