Problem with sample file 20readexcel5.php

Topics: Developer Forum, Project Management Forum, User Forum
Feb 6, 2009 at 12:40 AM
Ok guys, when I'm trying to run this sample file, 20readexcel5.php, it give me this error:

10:29:11 Load from Excel5 file
Notice: Undefined variable: spContainerCollection in C:\wamp\www\TESTFolder\Classes\PHPExcel\Reader\Excel5.php on line 683

Fatal error: Call to a member function getOPT() on a non-object in C:\wamp\www\TESTFolder\Classes\PHPExcel\Reader\Excel5.php on line 691

the lines in excel5.php are:

683: $spContainer = $spContainerCollection[$n + 1];

691: $BSEindex = $spContainer->getOPT(0x0104);

I'm thinking it has something to do with $spContainer ...

Anyways, I'm a n00b so accept my appologies.

One last question. I have an MySql database also and I need to imput the data from this excel file into the mysql tables. (That's why I wanted to test this example to see how it works. )The point is that the excel file is constanly changed, modified, etc. My question is, where can I find some tutorials using PHPExcel to input data from excel file into the database, but also to output data in the excel file.

Feb 6, 2009 at 12:52 AM
As for first problem, can you please try with latest source from here:

There was unfortunately a bug in PHPExcel 1.6.5 where reading would fail with PHPExcel_Reader_Excel5 whenever workbook contained 10 or more images:

If this is not the problem, please send Excel file to me (erik at phpexcel dot net).

As for second question, I believe it depends on what kind of data you are trying to insert. Maybe you can explain a bit, and someone here can better help.

Feb 6, 2009 at 7:14 AM
Koyama, thank you for you prompt replay.

I will try what you adviced me in the first matter with that sample file, let you know if any other problems.

Regarding the second matter is quite simple actualy (but nof for me, hehehe; not yet anyways :)) )

I have an MySQL database with, for example, with entries like: First_Name (varchar), Mdl_Name (varchar), Last_Name (varchar), Birthday (date), Gender (enum), Area (enum) ,etc

Now, I allready have a 10MB excel files with ~ 1500 entries that I need to put them in the database. I know there are a lot of automatic software programs that can convert excel file, CSV, XTM, etc into mysql data, but I'm interested in a PHP script so I can do this automaticaly from the web page on the server. Considering that the excel file is modifying every day, so that the data from the database to be updated also by an automatic script. So, there are 2 problems actualy. How to implement the very nice libraries from PHPExcel, in order to extract data from the excel file and transfer it inside the database, and 2nd, how to create an automatic script that can do that thing everyday, let's say at 9.00AM. Maybe some tutorials or some links would help. I've search alot but apparently in vain....

Ok, thank you very much again for your time.
Feb 6, 2009 at 2:26 PM
How about using e.g. PHPExcel_Reader_Excel5 to read your workbook, then loop through the rows, and for each cycle insert one row in the database using a MySQL query from PHP?

I would start by getting this to work first, then later try to automate this as a periodical job via e.g. cron, if that's what you need.

Your workbook is quite large. Right now PHPExcel may not scale very well to fit that kind of workbook, but I suggest you try some experiments and see what works.