title: Move rows based on values in X column with triggers
body: <p>I am looking for a solution that will move an entire row's content based on what is in the specified cell when the function is run on a trigger. I can accomplish this using the <code>onEdit(e)</code> within sheets, but when running a "regular" version, nothing happens. No errors. </p>
  
  <p>I frequently use this type of functionality when a cell is edited, but for this specific sheet I need it to work when called (by trigger, manual, etc). </p>
  
  <pre class="lang-js prettyprint-override"><code>function archive(){
    // assumes source data in sheet named Form Responses
    // target sheet of move to named ARCHIVE
    // Target col is B (3)
    // Target value is "TEST" to move to "ARCHIVE"
  
  var sheet = SpreadsheetApp.getActiveSpreadsheet();
  var mainSheet = sheet.getSheetByName("Form Responses");
  var r = mainSheet.getActiveRange();
  
  if(r.getColumn() == 3 &amp;&amp; r.getValue() &gt;= "TEST"){
     var row = r.getRow();
     var numColumns = mainSheet.getLastColumn();
     var targetSheet = sheet.getSheetByName("ARCHIVE");
     var target = targetSheet.getRange(targetSheet.getLastRow() + 1, 1);
     mainSheet.getRange(row, 1, 1, numColumns).copyTo(target, {contentsOnly:true});
      mainSheet.deleteRow(row);
     }
  }
  </code></pre>
  
  <p>When ran, nothing happens to the sheet. No error, no logs, etc.</p>