1

I am trying to read spreadsheet(.xls) using spreadsheet_excel_reader. My code is a below :

<?php
require_once 'Excel/reader.php';
$data = new Spreadsheet_Excel_Reader();
$data->setOutputEncoding('CP1251');
$data->read('test.xls');
echo $data->sheets[0]['numRows'];die;
?>

this returns number of row till where the data is. If there is any data on row 65536 the it returns 0. Actual return value should be 65536. Is there any fix or work around for this ?

Harjeet Jadeja
  • 1,594
  • 4
  • 19
  • 39
  • 2
    Have you seen this yet? https://stackoverflow.com/q/197762/1415724 or https://stackoverflow.com/q/4895230/1415724 or https://github.com/iliaal/php_excel/issues/13 - Sounds like you've hit the limit. – Funk Forty Niner Aug 11 '17 at 11:58
  • @Fred-ii- Thanks for reply with links .. so what is the bottom line here ? – Mittul At TechnoBrave Aug 11 '17 at 12:00
  • yes, the limit is till 65536, but the spreadsheet allows us to write on 65536 row then it should also allow us to read the data on 65536 row. – Harjeet Jadeja Aug 11 '17 at 12:00
  • Welcome. TBH, I won't be able to provide you with a solution. I Google'd the error to see possible solutions for you to look into. Let's see if someone else can help you with this. However, go through those Q&A's and see if those will help you, there should be something in there that may provide a solution. – Funk Forty Niner Aug 11 '17 at 12:04
  • I'm not familiar with php, but if you can somehow check if there is data in first row, but the result is 0, then you know the right value is the worksheet limit (65536 in this case). – Egan Wolf Aug 11 '17 at 12:13
  • `PHPExcel` !== `Spreadsheet_Excel_Reader` – Mark Baker Aug 11 '17 at 18:17

1 Answers1

0

I probably did not get the point but this could be due to the fact, that the first line starts with 1 in Excel while it starts with 0 in most coded implementations. So if you have 10 lines in Excel you have indexes from 0-9 = 10 values!

Johannes
  • 11
  • 2