title: Inaccurate data about getHighestRow()
body: <p>i am trying to get the last row that contains data in an excel workbook the problem is in some sheets i get the correct data but in other sheets i don't , i tried to change my code by using <code>getHighestDataRow()</code> instead of <code>getHighestRow()</code>   but i keep getting the same results so i updated my PHPExcel library from PHPExcel_1.7.9_doc to PHPExcel_1.8.0_doc but the same result too .
  any ideas ?</p>
  
  <p>i am thinking to make an if statement in a loop to test each row if it is empty or not .</p>
  
  <pre><code>     $lastRowt = $excel2-&gt;getActiveSheet()-&gt;getHighestDataRow();
        echo" $lastRowt ";
  </code></pre>
  
  <p><code>$lastRowt</code> keep getting 34 but it is only 30 .</p>
  
  <pre><code>    &lt;html&gt;
      &lt;?php
  
      ini_set('max_execution_time', 300);
      ini_set("memory_limit",-1);
  
      require_once 'PHPExcel_1.7.9_doc/Classes/PHPExcel/IOFactory.php';
       require_once 'include/adb.php';
  
      $excel2 = PHPExcel_IOFactory::createReader('Excel2007');
      $excel2 = $excel2-&gt;load('try.xlsx');
  
  
      $sheetCount = $excel2-&gt;getSheetCount();
      for ($x=0; $x&lt;$sheetCount; $x++) {
      echo"now $x &lt;br&gt;";
  
      $excel2-&gt;setActiveSheetIndex($x);
  
       $objWorksheet = $excel2-&gt;getActiveSheet();
  
       $po  =   $objWorksheet-&gt;getCellByColumnAndRow(1, 7)-&gt;getValue();
       $in  =   $objWorksheet-&gt;getCellByColumnAndRow(6, 7)-&gt;getValue();
  
      $id = date('Y-m-d',PHPExcel_Shared_Date::ExcelToPHP($objWorksheet-&gt;getCellByColumnAndRow(6,                 8)-&gt;getValue()));
  
  
       $esv =   $objWorksheet-&gt;getCellByColumnAndRow(4, 19)-&gt;getValue();
       $won =   $objWorksheet-&gt;getCellByColumnAndRow(0, 21)-&gt;getValue();
       $DTH =   $objWorksheet-&gt;getCellByColumnAndRow(1, 21)-&gt;getValue();
       $wn  =   $objWorksheet-&gt;getCellByColumnAndRow(3, 21)-&gt;getValue();
       $rco =   $objWorksheet-&gt;getCellByColumnAndRow(4, 21)-&gt;getValue();
       $wc  =   $objWorksheet-&gt;getCellByColumnAndRow(5, 21)-&gt;getValue();
       $rch =   $objWorksheet-&gt;getCellByColumnAndRow(6, 21)-&gt;getValue();
       $wd  =   $objWorksheet-&gt;getCellByColumnAndRow(0, 22)-&gt;getValue();
       $cs  =   1 ;
  
  
  
       $query="INSERT INTO invoice 
      (saponum, invoicenum, invoicedate, esvnum,workordernum, dth, wellnum, regcode, wellcharge,         rigcharge, workdescription, idc)VALUES 
      (  '$po',      '$in',       '$id', '$esv',      '$won','$DTH', '$wn',  '$rco',      '$wc',            '$rch',           '$wd', '$cs' )";
      echo" query  &lt;br&gt; $query &lt;br&gt;";
      mysql_query($query);
  
  
        $queryi="select idv from invoice where invoicenum = $in ";
        echo" query  &lt;br&gt; $in &lt;br&gt;haya de el qwery bta3et el idv $queryi ";
       $idnt = mysql_query($queryi);
  
       $outputidernt=mysql_fetch_array($idnt);
      extract($outputidernt);
  
       $lastRowt = $excel2-&gt;getActiveSheet()-&gt;getHighestDataRow();
      echo"&lt;br&gt; $lastRowt &lt;br&gt;";
       $rn = 25 ;
       for($i=$lastRowt ; $i&gt;=28 ; $i--){
  
       $qty  =        $objWorksheet-&gt;getCellByColumnAndRow(0, $rn)-&gt;getValue();
              echo "qty = $qty";
       $item =        $objWorksheet-&gt;getCellByColumnAndRow(1, $rn)-&gt;getValue();
              echo "item = $item";
       $describtion = $objWorksheet-&gt;getCellByColumnAndRow(2, $rn)-&gt;getValue();
              echo "describtion = $describtion";
       $unit =        $objWorksheet-&gt;getCellByColumnAndRow(4, $rn)-&gt;getValue();
              echo "unit = $unit";
       $pric =        $objWorksheet-&gt;getCellByColumnAndRow(5, $rn)-&gt;getValue();
              echo "pric = $pric";
       $rn++ ;
  
  
  
       $queryit=" SELECT ids FROM pricelist WHERE itemnum = '$item' AND saponum = '$po' ";
       echo" queryit  &lt;br&gt; $queryit &lt;br&gt;";
       $idniter = mysql_query($queryit);
  
      $outputider=mysql_fetch_array($idniter);
      extract($outputider);
  
  
        $querys="INSERT INTO invoicestep ( ids , quantity , idv) VALUES ( '$ids','$qty','$idv' )";
      echo" querys  &lt;br&gt; $querys &lt;br&gt;";
      mysql_query($querys);
  
       }
  
       }
  
  
  
  
  
  
      ?&gt;        
      &lt;/html&gt;
  </code></pre>