Filter data from one sheet to another
<p>I am new to arrays and have found myself at a dead end.</p>

<p>I would like to:</p>

<ol>
<li>Take all the data from one sheet and put it into an array.</li>
<li>Pick out certain information from that array, and add it to a new array.</li>
<li>Save that new, filtered array to a different sheet.</li>
</ol>

<p>Here's what I have:</p>

<pre class="lang-js prettyprint-override"><code>function myFunction() 
{
  var ss = SpreadsheetApp.openById('ID');
  var sheet1 = ss.getSheetByName('sheet1');
  var sheet2 = ss.getSheetByName('sheet2');
  var range = sheet1.getDataRange();
  var values = range.getValues();
  var lastRow = sheet1.getLastRow();
  var lastCol = sheet1.getLastColumn();      
  var rowCounter = 0;
  var inArr = new Array(new Array());
  var outArr = []
  for (var i = 1; i &lt;= lastRow; i++) 
  {
     var suspended = values[i][39]; //this value is ether True or False
     if (suspended == 'False')
     {
        rowCounter = rowCounter +1;
        outArr[rowCounter] = [];
        inArr[i] = values[i];
        for (var j = 0; j &lt;= 42; j++) 
        {        
           outArr[rowCounter].push(inArr[i][j]);
      }
   }
}
sheet2.getRange(1, 1,rowCounter,lastCol).setValues([outArr]);
}
</code></pre>

<p>The inArr array is collecting the entire row, but I would like to collect only specific columns in that row:</p>

<pre><code>values[i][0], values[i][26], values[i][28]
</code></pre>

<p>Also when I try to append the array to the sheet I get an error:</p>

<blockquote>
  <p>Incorrect range width, was 1493 but should be 1</p>
</blockquote>

<p>What changes will fix these problems?</p>