We (at work) often offer clients the solution to batch upload data to a web site using excel files. The obvious alternative is to uplad a tab delimeted text file, but then you have to explain to the end user how to save the excel file to text (which is puting the client do our job in a way..).
The solution we had so far was to use xlhtml on the server side to transform the XLS file to XML. Then it is relatively easy to parse it using PHP. This worked quite fine for as long as we were on a Linux server (where compiling and running xlhtml is straight forward).
Lately we had to implement similar functionality (in PHP too) on an IIS (the MS equivelent of Apache) running on Windows NT. The solution Alex came up with was to use PHP-ExcelReader, an excelent library that can parse an XLS file and return a PHP array. It works like a charm!
Do you know of any alternatives?
This parser are very useful!!! Thanks to its developer!
i find PHP-ExcelReader so hard ,thanks
I neet the parser,how can i download it,thanks
Wow! PHP-ExcelReader saves the day! An extremely impressive Class–did just what I needed! Haven’t had a need for parsing XLS->Array since Perl, so I am truly grateful.
It was so easy to implement, fit right into my model!
Just download from SourceForge, take the example page and replace .XLS with file/paramter of your choice. Loop through each cell with ease!
PHP-ExcelReader is a really, really useful tool, just what I needed! Many thanks to the developers!!!
I have just one question – is it possible to discard these rows and collumns that are hidden in the xls-file and how?
PHP-ExcelReader is a useful tool to parse XLS to PHP array. Thanks to the developers for publishing this tool to the web.
P.S. How can I parse from php-array to xls file? If you have such script please notify my. Thanks
There is a little problem with 64bit OS, function GetInt4d is not working
Error:
Notice: Uninitialized string offset: x in Excel/oleread.inc on line 27
/* function for 32 bit os
function GetInt4d($data, $pos) {^M
return ord($data[$pos]) | (ord($data[$pos+1]) =128)
$_ord_24 = -abs((256-$_or_24)
I found this on:
http://forum.ovh.com/showthread.php?t=12695
Very good script.
But how to make it work with UTF-8 encoding?
$data->setOutputEncoding(‘utf-8′); – doesnt work.
Please help!
Pingback: Διαβάζοντας αρχεία xls με PHP « ale3andro’s blog
Warning: main(Spreadsheet/Excel/Reader/OLERead.php): failed to open stream: No such file or directory in /www_mounted/interno/htdocs/interno/util/ExcelReader/Excel/reader.php on line 31
There is the file in the package.”Spreadsheet/Excel/Reader/OLERead.php”.
I am using modified version of Simple XLSX PHP Class called XLSX Parser ( http://www.spyrozone.net/project/xlsx-parser/ ) by Sergey Shuchkin & Spyro Kid. The package contain the php class and some useful example (display the result as array, display the result in table, count worksheets, display all worksheet name, display desired worksheet name, convert excell date format, and more).