title: copy one row from one sheet to another
body: <p>I know this has been asked before because I have spent the last 5 hours trying them all from here and even the closed google product forum. I can't get any of the loops to stop. The conditions are getting met, but the loop keep running and running. I have been copying from other examples online and inserting my own variables, but in the end, I'll have 5 rows go to the new sheet several times until the sheet gets tired or something.</p>
  
  <p>I've tried getDataRange...I've tried getRange...I've tried var in loops and other loops, I've tried them all, so please take a look and let me know how this code keeps resulting in rows getting added to the new sheet multiple times over:</p>
  
  <pre><code>function runReportAllMemCos1() {
    var sheet1 = sskey.getSheetByName('Businesses');
    var sheet2 = sskey.getSheetByName('tempsheet');
  
    var data = sheet1.getRange(1,1, sheet1.getLastRow(), sheet1.getLastColumn()).getValues();
  
    var dest = [];
    for (var i = 0; i &lt; data.length; i++ ) {
      if (data[i][12] == "Associate") { 
        dest.push(data[i]); 
      } Logger.log(data)
      if (dest.length &gt; 0 ) {
      sheet2.getRange(sheet2.getLastRow()+1,1,dest.length,dest[0].length).setValues(dest);
      }
    }
  }
  </code></pre>
  
  <p>Thanks for any help!</p>