You would have to figure out the file format that excel saves to and then read it with php. I would recommend saving your excel doc as csv (comma separated values) and then parsing that in php would be no problem.
Yeah, I'm already able to do that, but I wanted to take out the "human" part of the step and just read the original xls from php and then pump it into my database... Right now I do what you've said, open the file in Excel, save it as a csv and then let my script have at it.
Perl has CPAN modules to read excel files as is. There is also the SQLFairy project (written in perl) that can convert an Excel document to sql. Not sure if PHP has anything similar, but if it did it would be in the PEAR extensions I believe.
duh.. here you go http://sourceforge.net/projects/phpexcelreader/ found in 3 seconds on Google. That includes doing one search, opening up one result and following one link to sourceforge
Yes, I already had a look at phpexcelreader. The problem with that is that it reads the entire spreadsheet at once, and if you've got a large spreadsheet ( like I do) memory is exhausted almost immediately. Google is my friend, I wouldn't be asking here if I was able to find what I needed via Google.
Ah, then maybe your question should have been: I have tried phpExcelReader, and it runs out of memory. Is there any way to modify it to make it work, or do you know of any other way of reading an excel file? Because of Excel's format, you probably can't just modify phpExcelReader so that it reads part of a file, becuase we probably have to see the entire file to parse it. Why don't you try increasing php's memory (in php.ini).
I haven't looked at phpexcelreader, and don't plan to, but a good way I use to get around memory issues is popen('cat ' .$filename, 'r'); instead of fopen. You can then use fgets($whatever, 1024); to grab a line at a time from within a !feof loop.
Have you thought about going at the problem from a slightly different angle? Depending on what type of database you are using, there may be an import option within it. Just a thought(?)
I am attaching the 4 files, which help in reading the excel file using PHP 4.4. It can be used in Windows/linux or any environments Thanks itsbobbs@gmail.com
I am attching the zip file, which contains of the file to help you in reading excel file Thanks itsbobbs@gmail.com 9840529212 India
Great little scripts thanks a lot. any idea why in FF it my first column would render like ["term"]=> string(36) "a�u�t�h�o�r�i�t�y� �d�o�g� �f�o�o�d�" with a question mark between each letter? In shell output it does and IE it doesn't. Only in FF.
I have an xml doc that has more than one sheet. exactly 7. can the script read that? or what are the other solutions available? Thanks.
This script can read .xls file with more than one sheet. But not xml doc. You can download the latest one of phpexcelreader Best of luck Taslim Sohel