PHPExcel: Undefined offset with particular file

Hi Experts,

I'm trying to load the attached Excel file using PHPExcel, but as soon as I do, I get:
Notice: Undefined offset: 8 in C:\inetpub\wwwroot\CSS_Reservations\excel_lib\PHPExcel\Reader\Excel5.php on line 5873

Notice: Undefined offset: 7 in C:\inetpub\wwwroot\CSS_Reservations\excel_lib\PHPExcel\Reader\Excel5.php on line 5873

Notice: Undefined offset: 7 in C:\inetpub\wwwroot\CSS_Reservations\excel_lib\PHPExcel\Reader\Excel5.php on line 5873

Notice: Undefined offset: 6 in C:\inetpub\wwwroot\CSS_Reservations\excel_lib\PHPExcel\Reader\Excel5.php on line 5873

Open in new window


My code thus far is
        global $env;
        //copy template file
       
            //Temporarily Change directory to root to copy files...
            $currentDIR = getcwd();
            chdir("../../");
            $rootDIR = getcwd();
            //Change DIR back
            chdir($currentDIR);
            
        $slash = DIRECTORY_SEPARATOR;

        //echo 'dir = ' . $currentDIR . '<br>';
        
        
        $file_name = "NiagaraPAXreport_" . $_SESSION['sess_id'] . ".xls";
        
        $file_from = $rootDIR . $slash . "reports" . $slash . "niagara_pax"
                                    . $slash . "NiagaraPAXreport_template.xls";
        
        $file_physical = $rootDIR . $slash . "downloads" . $slash . $file_name;        
        $file_virtual = $env['url'] . '/downloads/' . $file_name;        
        $copy_success = copy($file_from, $file_physical);          
        
        //Define From / To Dates as objects        
        $date_from = new DateTime($from);
        $date_to = new DateTime($to);
        
        /** Include PHPExcel **/
        error_reporting(E_ALL);
        set_time_limit(0);
                
        $fileType = 'Excel5';
        
        require_once '../../excel_lib/PHPExcel/IOFactory.php';
        
        // Read the file
        $excelReaderObj = PHPExcel_IOFactory::createReader($fileType);
        $excel_obj = $excelReaderObj->load($file_physical);

Open in new window


The error goes away if I comment out the last line, but I need that in order to be able to work with the file.

Additionally, I'm using this same code in another module with another file, and it works.  I also went into that module, swapped that file with the attached, it stopped working (same errors).  

Therefore, something is wrong with the attached file, but what?  I even removed the chart on the second sheet - the error persist.

Any help will be greatly appreciated.

Thank you.
NiagaraPAXreport-template.xls
APD TorontoSoftware DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ray PaseurCommented:
Not sure what you're expecting here, but I opened the file in Excel and made two screen shots.  Both worksheets show "division by zero" errors.  It looks like there is no data in these worksheets - just some formulas that refer to empty cells.  It's probably worth implementing some kind of test to see if the PHP variables are set before using them in an assignment statement.  Also, you may want to get rid of set_time_limit(0) and use a different strategy to extend execution time.  It risks leaving your script in an infinite loop!

The workbook opens to the cover sheet; the second screen shot is the other page.
Excel Workbook Cover SheetExcel Workbook Daily Passenger Totals
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
APD TorontoSoftware DeveloperAuthor Commented:
I'm also able to open this file manually in MS Excel, but it won't let me open it (load it) through PHPExcel
0
APD TorontoSoftware DeveloperAuthor Commented:
I had to recreeate the file.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.