Getting Wrong row count while reading xlsx files using getHighestRow()

Topics: Developer Forum, Project Management Forum, User Forum
Sep 18, 2010 at 7:29 AM


I am new to PHPExcel and PHP.

I am using wamp 2.0 in my local system, I have created a file to read an xlsx file, when I execute the page I get wrong row count. I have 10 rows but the page displays as 3 rows.

My code is given below


require_once 'PHPExcel/Reader/Excel2007.php'
$objReader = PHPExcel_IOFactory::createReader('Excel2007');
$objPHPExcel = $objReader->load("xl_data/worksheet.xlsx");
$objWorksheet = $objPHPExcel->getActiveSheet();

echo $highestRow = $objWorksheet->getHighestRow();


My excel file (worksheet.xlsx) has 10 rows with values as 1,2,3,4,5,6,7,8,9 and 10 respectively

I expect the row count to be 10

But the variable $highestRow returns 3

Is there something wrong in my code ??

Pls help

- Praveen


Sep 18, 2010 at 11:49 AM

I'd need to know see the Excel workbook to be able to identify if there was any problem. Is it possible for you to upload it somewhere that I can access it?

Sep 18, 2010 at 12:37 PM

Hey Mark,

Thanks for your response !

My code is available at

1. Both xlsx and php file in rar format



2. My xlsx file



3. My php file



Thanks for your support

- Praveen

Sep 20, 2010 at 12:20 PM

Hey Mark,

I have solved the issue, there was an issue with my "php_zip" extension

thanks for your support.

- Praveen

Sep 21, 2010 at 1:32 PM
praveenkumarek wrote:

I have solved the issue, there was an issue with my "php_zip" extension

 Glad to hear that you've resolved this, because I hadn't been able to replicate the problem myself even with your code and workbook.