Undefined offset: 1 in PHPExcel.php

Topics: Developer Forum, Project Management Forum
Feb 27, 2010 at 6:08 AM
Edited Feb 27, 2010 at 6:09 AM

Hello. I considered the sample “07reader.php” and tried to read my own XSLX file using this sample. The original sample works fine and the whole table is displayed successfully.

As there are timestamps in Excel table (e.g. “10:54”) I have to to transform the format to display these data (“0.xxxxxxx” → “xx:xx”). I use this sample: “PHPExcel — Discussions — How to read a time value?”

The source XLSX file is correct and has been created using MS Excel 2007. Here is a screenshot of the table:


(there are russian characters but it doesn't matter 'cause the original unmodified sample works fine).

So there is the following script:


doesn't work properly:


<b>Notice</b>:  Undefined offset:  1 in <b>C:\www\htdocs\excel\Classes\PHPExcel.php</b> on line <b>565</b><br />
<br />
<b>Fatal error</b>: Call to a member function getNumberFormat() on a non-object in <b>C:\www\htdocs\excel\Classes\PHPExcel\Style\NumberFormat.php</b> on line <b>187</b><br />
Mar 19, 2010 at 2:04 AM

Hmm... This seems like the same bug as this:


Can you upload schedule.xlsx somewhere so we can test?

Mar 19, 2010 at 5:29 AM



Mar 19, 2010 at 6:02 AM

Bug now fixed with the help of your example.

See work item 11964:


Download latest source code in a couple of hours:


However, note that in your case you should actually not use this



The reason is that you lose number formatting. When that happens cells with dates just look like numbers.