Create Excel Documents from PHP using PHPExcel
If you need to code an application that should create Excel documents from PHP code, then we can recommend another useful library for PHP and Excel integration. This library is available for free from Codeplex, the Project Hosting for Open Source Software from Microsoft (since version PHPExcel 1.7.8 it was moved to Github instead), and uses OpenXML standard. PHPExcel can read, write and create from scratch Excel documents in PHP. It is a complete spreadsheet engine for PHP developers.
The project provides a set of classes for the PHP programming language, which allow you to write to and read from different spreadsheet file formats, like Excel (BIFF) .xls, Excel 2007 (OfficeOpenXML) .xlsx, CSV, Libre/OpenOffice Calc .ods, Gnumeric, PDF, HTML.
PHPExcel is built around Microsoft’s OpenXML standard (the same used for other documents like PowerPoint XML standard for presentations) and PHP programming language, and you can get impressed about the great features this class provide such as setting spreadsheet meta data (author, title, description, etc.), work with multiple worksheets in the same document, change to use different fonts and font styles, cell borders, fills, gradients, adding images to your spreadsheet, calculating formulas, converting between file types and much, much more. If you are using Yii as the PHP Framework, then you have some wrappers like EExcelView.
Learn more in http://www.phpexcel.net or download source code from PHPExcel Github