Notice: Undefined offset: -1 in PHPExcel.php on line 191

Topics: Developer Forum
May 25, 2012 at 8:36 AM
Edited May 25, 2012 at 8:42 AM


I get a notice when I try to convert excel2007 file to excel5. And a notice is:

Notice: Undefined offset: -1 in C:\Users\....\library\Vendor\PHPExcel.php on line 191

My code:

$xlsReader = new \PHPExcel_Reader_Excel2007();
$phpExcel = $xlsReader->load(APPLICATION_PATH . '/../temp/test.xlsx');

$writer = new \PHPExcel_Writer_Excel5($phpExcel);
$writer->save(APPLICATION_PATH . '/../temp/converted_to_xls.xls');

Am I doing something wrong? I've noticed that when  I removed:


notice disappear.

I'm using PHPExcel version 1.7.7.

May 26, 2012 at 3:32 PM
Edited May 26, 2012 at 3:33 PM

It's more likely that there's some feature being used in the file you're loading that PHPExcel doesn't recognise, and that is preventing the reader from setting the currently active worksheet within the workbook correctly. Is it possible for you to attach a copy of the test.xlsx file so that I can see why the the active worksheet is being mis-defined?

May 26, 2012 at 3:55 PM

I've created test.xlsx using office 2010. It's very simple, just some text in few cells. I didn't use any formatting. File is on my computer at work so I'll attach this file on Monday.

Jun 4, 2012 at 2:29 PM
Edited Jun 4, 2012 at 2:35 PM

Sorry for delay. I don't know how to attach file to my post so here is the file: .