Ilia Alshanetsky have just announced a new PHP Excel extension that he wrote after getting his right hand broken three weeks ago while biking. Good to hear that you are well Ilia ! I’m not a big fan of Excel, but I had faced similar issues mainly with memory usage while generating Excel files with PHP. The new extension uses LibXL, a closed source commercial product but very fast and small according to Ilia.

“The library natively generates BIFF 7/8 format, which can be opened all devices and Excel readers I’ve tried it on and is available for Linux, Mac and Windows”. he added “The end result is a PHP extension that offers a complete, object oriented interface to the library that allows you to do just about anything with Excel. I’ve also introduced a few helper functions to streamline reading/writing from Excel files. The speed and memory usage are pretty damn impressive, on my debug build of PHP, it can generate 10,000 cells in 0.03 seconds with a 262kb complete PHP memory usage, not just the code.”

Sample usage of the extension :

$sT = microtime(1);
$x = new ExcelBook();
$s = $x->addSheet("Sheet 1");
for ($i = 0; $i < 1000; $i++) {
for ($j = 0; $j write($i, $j, ($i * $j));
}
}
$x->save("bench.xls");
$eT = microtime(1);
var_dump(($eT - $sT), memory_get_usage(1), memory_get_peak_usage(1));

Code source available here, more information available here.