Forum Moderators: coopster

Message Too Old, No Replies

Parsing of Excel file in PHP?

         

maperen

9:44 am on Apr 4, 2003 (gmt 0)

10+ Year Member



Hello!

Does anybody know scripts which can parse Excel file on-fly
and writtin in the pure PHP (w/o any COM features and additional libs and php-extensions).

I want to fill MySql database by uploading Excel file.

Thank you a lot.

Maxim

dmorison

10:12 am on Apr 4, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Maxim,

I don't know of a library that provides .xls reading capabilities, and being a proprietary Microsoft format you are unlikely to find one that has any degree of reliability to it across different Excel version.

One option that may be available to you is to ask your users to save out of Excel in "Comma Delimited" (.csv) format.

You can then have them upload the .csv file and parse that into your database.

Reading a .csv file line by line (using fgets() and then explode()) should be straight forward.

Hope this helps!

maperen

10:40 am on Apr 4, 2003 (gmt 0)

10+ Year Member



I think that I find the solution.
Here is a script:
<snip>

And seems it can parse any excel file into the PHP structures. Only one thing - it's commercial and costs about 99$.

Seems that except parsing csv there is no free solutions.

Thank you anyway for your suggestion.

Maxim

[edited by: jatar_k at 4:38 pm (utc) on April 4, 2003]
[edit reason] no commercial product links thanks [/edit]

jatar_k

4:40 pm on Apr 4, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Why does it have to be excel format? Why not just save it as csv and use fgetcsv [php.net]?

Welcome to WebmasterWorld maperen and dmorison

tstaheli

5:16 pm on Apr 7, 2003 (gmt 0)

10+ Year Member



If you save it as a CSV, phpMyAdmin will upload it to the MySQL database for you, I'm over-impressed with the functions of phpMyAdmin