Tag Archives: xls php excel 解析

Parsing XLS files with PHP

使用PHP解析excel文件(Parsing XLS files with PHP)

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?