Performant Handling of Excel Files in PHP

When you look at Excel solutions for PHP, the first thing you find is PHPExcel, digging a little bit further lets you find libXl. The prior is a pure PHP solution, the latter a native library for a couple of operating systems. There is a PHP extension that exposes this library to PHP, so you can do the same things with it that you can do with PHPExcel.

TL;DR: PHPExcel is nice, libXl with php_excel can do the same WAY faster. Use the Diagrams below to convince your customer/boss/CFO to invest in performance.


Import and export data using PHPExcel

There’s a newer version of this article topic available (2014). Please read on at Performant handling of Excel files in PHP.
A few weeks ago I had to read and write Excel files of the format BIFF8 (Excel 97), because the customer did not accept the workaround of exporting data to CSV. PEAR’s Spreadsheet_Excel_Writer combined with the project Spreadsheet_Excel_Reader on SourceForge was a good helper in the past – but only for BIFF5. BIFF8 support in spreadsheet excel writer has been a problem for a long time, and according to the authors, is still somewhat kludgy in the current version. So I needed an alternative.After a short research I stumbled upon PHPExcel which supports reading and writing of many formats in one API. It is released under the GNU Lesser General Public License which gives you the freedom to use it in commercial applications.
Output and input formats are not limited to Excel files. This article gives you a short overview about what you can do with it and demonstrates the basic usage. Weiterlesen