title: Conditional MOVE data from one sheet to another in google spreasheet
body: <p>I got the code online and added in the if statement myself and it did not work.
  What i would like to achieve:</p>
  
  <ol>
  <li>One column to indicate 'ok' . If 'ok' is present, that row of data will be moved to the other spreadsheet.</li>
  </ol>
  
  <pre class="lang-js prettyprint-override"><code>    function moveData(){
        var app = SpreadsheetApp;
        var activeSheet = app.getActiveSpreadsheet().getActiveSheet();
        var originalSheet = app.getActiveSpreadsheet().getSheetByName("Form Responses 4");
        var copySheet = app.getActiveSpreadsheet().getSheetByName("RECORDS");
        var lc = originalSheet.getLastColumn();
        var lr = originalSheet.getLastRow();
        var originalData = originalSheet.getDataRange().getValues();
  
        for (var i=originalData.length-1; i&gt;=1 ; --i){
          var crange = originalSheet.getRange(i, 37).getValue();
          if ( crange == 'ok' ){
            copySheet.getRange(copySheet.getLastRow()+1, 1, 1, 
            originalData[i].length).setValues([ originalData[i] ]);
          }
        }
      }
  </code></pre>