title: Google Apps Script - Copy data to different worksheet and append
body: <p>I have looked at all the previous questions I could find, but I can never seem to make the different examples fit what I'm trying to do. </p>
  
  <p>I have forms that will be filled out by different users. I want the data on the "Data" sheet to be copied to an identically formatted separate spreadsheet upon choosing "Yes" in the dropdown in All!H35. There will be a form ("Source") for each team that will be filled out daily and ideally they all copy data to the next empty row(s) in the same master spreadsheet ("Destination"), creating a running list of all the work. </p>
  
  <p>[Source][1]</p>
  
  <p>[Destination][2]</p>
  
  <p>Edit:
  It's partially working, but only grabbing the first cell, even after adjusting for the remaining columns and rows.</p>
  
  <pre><code>// Get the contents of a cell in srcSheet
    var range = srcSheet.getRange(1, 1, 16, 38);
    var values = range.getValues();
  
    // place it in the last row if the destination cell
    var range = srcSheet.getRange(1, 1, 16, 38);
    var values = range.getValues();
  </code></pre>
  
  <p>Finally got it to work. Here's the working code for reference.</p>
  
  <pre><code>function CopyRange() {
   var sss = SpreadsheetApp.openById('1zxyKx4GsBgD7hRzWT3TSvJto-R-rJoNwLu-0s5zFtko'); //replace with source ID
   var ss = sss.getSheetByName('DataTS1'); //replace with source Sheet tab name
   var range = ss.getRange('A2:AL17'); //assign the range you want to copy
   var data = range.getValues();
  
   var tss = SpreadsheetApp.openById('1DrCgrLIrybN4a-UqlBsGSJy5p8XBPWNR2ftviwTA5_Y'); //replace with destination ID
   var ts = tss.getSheetByName('All Data'); //replace with destination Sheet tab name
  
   ts.getRange(ts.getLastRow()+1, 1,16,38).setValues(data); //you will need to define the size of the copied data see getRange()
  
  }
  </code></pre>