Akeneo Spreadsheet parser. Reads XLXS files from Microsoft Excel and Open Office

Installs: 3 272

Dependents: 2

Stars: 33

Watchers: 18

Forks: 10

Open Issues: 5

Language: PHP

v1.1.6 2015-08-12 14:54 UTC


This component is designed to extract data from spreadsheets, while being easy on resources, even for large files.

The actual version of the spreadsheet parser works with csv and xlsx files.

Scrutinizer Code Quality

Installing the package

From your application root:

$ php composer.phar require --prefer-dist "akeneo/spreadsheet-parser"


To extract data from an XLSX spreadsheet, use the following code:


use Akeneo\Component\SpreadsheetParser\SpreadsheetParser;

$workbook = SpreadsheetParser::open('myfile.xlsx');

$myWorksheetIndex = $workbook->getWorksheetIndex('myworksheet');

foreach ($workbook->createRowIterator($myWorksheetIndex) as $rowIndex => $values) {
    var_dump($rowIndex, $values);

By using the CSV parser options, you can specify the format of your CSV file :


use Akeneo\Component\SpreadsheetParser\SpreadsheetParser;

$workbook = SpreadsheetParser::open('myfile.csv');

$iterator = $workbook->createIterator(
        'encoding'  => 'UTF-8',
        'length'    => null,
        'delimiter' => ',',
        'enclosure' => '"',
        'escape'    => '\\'

foreach ($workbook->createIterator($myWorksheetIndex) as $rowIndex => $values) {
    var_dump($rowIndex, $values);

Running the tests

To run unit tests, use phpspec:

$ php bin/phpspec run

To run integration tests, use phpunit:

$ phpunit