qronicle/qexcel

Fast reader modification of PHPExcel

dev-master 2016-12-01 14:29 UTC

README

#QExcel

The Qronicle (or Quick - still haven't really decided) Excel library is an experimental Excel reader based on PHPExcel (http://phpexcel.codeplex.com/). It uses less resources by only looking at the actual content, ignoring styles etc.

This library should be helpful when importing excel files where the styling is not important. Keep in mind that it will only ever contain the Excel readers.

Progress

Basic functionality is all in place. The optimized Excel5, Excel2003XML, Excel2007 and CSV Readers are mostly ready. Everything is tied together by the QExcel class (that can be used as a replacement to PHPExcel's IO factory).

Up next is adding more documentation, example files (the test files I use now are not open for publication) and extending the index file with more sweetness to test out. If everything works I'll probably add the OO and other Readers from PHPExcel. I also need to check for updates on the PHPExcel front, should they have improved their readers.

Composer installation

composer require qronicle/qexcel

Getting started

// Always include the QExcel file
// This will start the autoloader and you will probably use the QExcel class to start as well
require_once('library/QExcel/QExcel.php');

// The workbook file
$filename = 'files/test.xls';

// Load the file into a QExcel_Workbook object
$workbook = QExcel::loadWorkbook($filename);

Performance

Tested with a file containing 2400 lines and 22 columns (mostly text and number fields). PHPExcel used setReadDataOnly as true.

Note that these are quickly made tests and that they are just an indication of the amount of memory and time that is won by ignoring the (for this library) unimportant data.

Excel2007 Reader

PHPExcel QExcel Gain
Memory usage 158.76 MB 8.87 MB 5.6% (18 times less)
Duration 18.35 seconds 3.01 seconds 16.4% (6 times faster)

Excel5 Reader

PHPExcel QExcel Gain
Memory usage 62.46 MB 12.40 MB 19.8% (5 times less)
Duration 7.77 seconds 2.86 seconds 36.8% (3 times faster)

Excel2003XML Reader

PHPExcel QExcel Gain
Memory usage 172.29 MB 6.08 MB 3.5% (28 times less)
Duration 13.67 seconds 2.66 seconds 36.8% (5 times faster)

CSV Reader

PHPExcel QExcel Gain
Memory usage 55.29 MB 6.31 MB 11.4% (9 times less)
Duration 6.80 seconds 0.42 seconds 6.1% (16 times faster)