PHP Excel Export class
Written on March 27, 2007
Following the code that I found here, I made a quick PHP4 class that creates a single sheet Excel file. The class has a download() function that will send the appropriate headers for a binary download.
ExcelExport.php - Rename to ExcelExport.php.
Usage
require_once "ExcelExport.php";
$xls = new ExcelExport();
$xls->addRow(Array("First Name","Last Name","Website","ID"));
$xls->addRow(Array("james","lin","www.chumby.net",0));
$xls->addRow(Array("bhaven","mistry","www.mygumballs.com",1));
$xls->addRow(Array("erica","truex","www.wholegrainfilms.com",2));
$xls->addRow(Array("eliot","gann","www.dissolvedfish.com",3));
$xls->addRow(Array("trevor","powell","gradius.classicgaming.gamespy.com",4));
$xls->download("websites.xls");
Filed in: php, web development.
How can i use this script with array’s?
I want to get all de field names from my Database and set this at the first line of my excel file?
Really nice.
How can I make it output the data in utf-8?
I have tested your Excel export script and it works great except one thing. It seems to have problem if the text is longer than 255 characters in the same cell. Do you know why?
Hey! Nice class. Works very well. But how can I add a auto sum formula on the generated excel sheet?
Thanks for providing this. ツ