Updated PHP Excel Reader Project CodeUnit 07 DEC 2009

For a long time there has been the excellent SourceForge Excel Reader PHP class available to developers wishing to add Excel parsing to their offerings, but unfortunately active development on the code stopped absolutely months ago already.

Thankfully for us though, a guy by the name of Matt Kruse picked up this dropped project, put it up on Google Code and continued to update and make the code a little bit more usable in the process.

Implementing Excel parsing (only up to Office 2003 format, i.e. .xls files) is as simple as including a single file and then pointing a valid Excel document at its constructor function:

$data = new Spreadsheet_Excel_Reader(“test.xls”);

From there it is a matter of accessing the spreadsheet data by using a number of methods available to you. For example, to retrieve formatted value of a cell you have the following options available to you:

Retrieve formatted value of cell (first or only sheet): 


Or using column names: 


From a sheet other than the first: 


You can also retrieve cell info such as: 


or get the active sheet size: 


There’s a fair bit of functionality available to you, all neatly stored in the help documentation, meaning that now there is absolutely no excuse for not supporting Excel spreadsheet parsing in your PHP projects any more! :P


Related Link: http://code.google.com/p/php-excel-reader/

About Craig Lotter

South African software architect and developer at Touchwork. Husband to a cupcake baker and father to two little girls. I don't have time for myself any more.