title: Issue Looping through Google Spreadsheet and Retrieving Cell Values
body: <p>My apologies in advance for any stupid questions... I'm a completely new to JS and scripting in Google Docs.</p>
  
  <p>I'm trying to write a bit of code to delete all the rows in a google spreadsheet that has the word "Received" or "Canceled" in the first column of the row.</p>
  
  <p>Here is my current code:</p>
  
  <pre><code>function DeleteClosedRows() {
  
      var ss = SpreadsheetApp.getActiveSpreadsheet();
      var end = SpreadsheetApp.getActiveSheet().getLastRow();
      for( var i = 3; i &lt; end + 1; ++i ) {
          var value =  ss.getActiveRange().getCell(i, 1).getValue();
          if (value === "Received" &amp;&amp; value === "Canceled") {
              sheet.deleteRows(i); 
          };
      };  
  };
  </code></pre>
  
  <p>When I try to run this I get the error "Cell reference out of range"</p>
  
  <p>When I look at the Execution Transcript it says the last action taken was:
  Range.getCell([3, 1])</p>
  
  <p>.. I'm sure there are 100 things wrong with my code, but for now I'd love to understand the first issue that's stoping it from getting past that part.</p>
  
  <p>Thanks for your help!</p>