title: PHPExcel - How can i read the Excel sheet row by row
body: <p>How can i read Excel worksheet row by row using PHPExcel? I have a sheet contains more than 100000 rows, but i want to read only 500 rows.</p>
  
  <pre><code>$sheetData = $objPHPExcel-&gt;getActiveSheet();
  $highestRow = $sheetData-&gt;getHighestRow(); 
  $highestColumn = $sheetData-&gt;getHighestColumn(); 
  $highestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn); 
  
  echo '&lt;table&gt;';
  for ($row = 1; $row &lt;= $highestRow; ++$row) {
      echo '&lt;tr&gt;';
  
      for ($col = 0; $col &lt;= $highestColumnIndex; ++$col) {
      echo '&lt;td&gt;' . $sheetData-&gt;getCellByColumnAndRow($col, $row)-&gt;getValue() . '&lt;/td&gt;';
      }
  
      echo '&lt;/tr&gt;';
  }
  echo '&lt;/table&gt;';
  </code></pre>