title: How do I determine the end of the file using PHPExcel library in chunk loop?
body: <p>Using the PHPExcel library, I am attempting to iterate over around 1500 rows, each row has about 25 columns.</p>
  
  <p>I am using this code (taken from <a href="https://stackoverflow.com/questions/4817651/phpexcel-runs-out-of-256-512-and-also-1024mb-of-ram">PHPExcel runs out of 256, 512 and also 1024MB of RAM</a>):</p>
  
  <pre><code>/**  Create a new Reader of the type defined in $inputFileType  **/
  $objReader = PHPExcel_IOFactory::createReader($inputFileType);
  /**  Define how many rows we want to read for each "chunk"  **/ 
  $chunkSize = 20;
  /**  Create a new Instance of our Read Filter  **/ 
  $chunkFilter = new chunkReadFilter(); 
  /**  Tell the Reader that we want to use the Read Filter that we've Instantiated  **/ 
  $objReader-&gt;setReadFilter($chunkFilter); 
  
  /**  Loop to read our worksheet in "chunk size" blocks  **/ 
  /**  $startRow is set to 2 initially because we always read the headings in row #1  **/
  for ($startRow = 2; $startRow &lt;= 65536; $startRow += $chunkSize) { 
      /**  Tell the Read Filter, the limits on which rows we want to read this iteration        **/ 
  $chunkFilter-&gt;setRows($startRow,$chunkSize); 
  /**  Load only the rows that match our filter from $inputFileName to a PHPExcel Object  **/ 
  $objPHPExcel = $objReader-&gt;load($inputFileName); 
  //    Do some processing here 
  
  //    Free up some of the memory 
  $objPHPExcel-&gt;disconnectWorksheets(); 
  unset($objPHPExcel); 
  </code></pre>
  
  <p>}</p>
  
  <p>I want to process as many rows have data. I tried using the method getHighestRow() from the Worksheet object, but it just kept returning A1</p>
  
  <p>I also tried to check if the next retrieved row was empty by writing this little function:</p>
  
  <pre><code>function _emptyRow($row) {
      $empty=true;
  
      foreach($row as $r) {
      if ($r!='') {
          $empty = false;
          }
      }
  
      return $empty;
  
  }
  </code></pre>
  
  <p>So if _emptyRow() I will <code>break</code> out of the loop . This didnt work for me.</p>
  
  <p>Can anyone suggest a way to only retrieve all the records which have data? When I run this it even though only about 1500 rows have data it gets to about 23000 before timing out ( with set_time_limit(240));</p>