PHPackages                             ark4ne/xl-reader - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [PDF &amp; Document Generation](/categories/documents)
4. /
5. ark4ne/xl-reader

ActiveLibrary[PDF &amp; Document Generation](/categories/documents)

ark4ne/xl-reader
================

High performance Excel Reader (CSV, TSV, XLSX)

v2.0.0(1y ago)819.1k↓37.5%4[1 issues](https://github.com/Ark4ne/xl-reader/issues)MITPHPPHP ^8.0CI passing

Since Dec 2Pushed 1y ago4 watchersCompare

[ Source](https://github.com/Ark4ne/xl-reader)[ Packagist](https://packagist.org/packages/ark4ne/xl-reader)[ RSS](/packages/ark4ne-xl-reader/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (2)Versions (10)Used By (0)

xl-reader
=========

[](#xl-reader)

[![Build Status](https://github.com/Ark4ne/laravel-json-api/actions/workflows/php.yml/badge.svg)](https://github.com/Ark4ne/laravel-json-api/actions/workflows/php.yml/badge.svg)[![Coverage Status](https://camo.githubusercontent.com/1ddb41834ea3adc890a1cabbe75236eb4ef3e6bd82d10f91a23254d9f75101ca/68747470733a2f2f636f6465636f762e696f2f67682f41726b346e652f786c2d7265616465722f6272616e63682f6d61696e2f67726170682f62616467652e7376673f746f6b656e3d534935304e4a32304345)](https://codecov.io/gh/Ark4ne/xl-reader)

High performance excel reader, with very low memory consumption.

Installation
============

[](#installation)

```
$ composer require ark4ne/xl-reader

```

File support
============

[](#file-support)

- `xlsx`: fastest xlsx reader ever.
- `tsv`: tsv reader.
- `csv`: configurable csv reader (auto detect comma, or semi) .

Usage
=====

[](#usage)

### Read file

[](#read-file)

```
$file = "my-calc.xlsx";

$reader = \Ark4ne\XlReader\Factory::createReader($file);

$reader->load();

foreach ($reader->read() as $row){
    // do stuff
}
```

Each `$row` will contains data indexed by column key (A, B, C, ...).

```
/*
my-calc.xlsx
| A     | B     | C    |
| abc   | 123   | some |
*/
foreach ($reader->read() as $row){
    $row === [
        'A' => 'abc',
        'B' => '123',
        'C' => 'some',
    ];
}
```

With excel empty cells will not be reported

```
/*
my-calc.xlsx
| A     | B     | C    |
| abc   |       | some |
*/

foreach ($reader->read() as $row){
    // do stuff
    $row === [
        'A' => 'abc',
        'C' => 'some',
    ];
}
```

With numbers (mac), and many xlsx other generator, empty cells will be reported as `null`

```
/*
my-calc.xlsx
| A     | B     | C    |
| abc   |       | some |
*/

foreach ($reader->read() as $row){
    // do stuff
    $row === [
        'A' => 'abc',
        'B' => null,
        'C' => 'some',
    ];
}
```

### Work with sheets (XLSX Reader)

[](#work-with-sheets-xlsx-reader)

By default, the first sheet is read.

You can retrieve all worksheets with `getWorksheets()`.

```
$worksheets = $reader->getWorksheets();
/*
[
    ['id' => 1, 'name' => 'sheet 1'],
    ['id' => 2, 'name' => 'sheet 2'],
]
*/
```

You can retrieve selected worksheet with `getSelectedWorksheet()`.

```
$worksheet = $reader->getSelectedWorksheet();
/*
['id' => 1, 'name' => 'sheet 1'],
*/
```

You have three ways to select the sheets to work with:

- by index : `selectSheetByIndex(int $index)`
- by id : `selectSheetById(int $id)`
- by name : `selectSheetByName(string $name)`

Performance
===========

[](#performance)

legend`mem`php memory usage with `memory_get_peak_usage()``real mem`process real mem usage with `/usr/bin/time -l php ...`Memory
------

[](#memory)

The memory usage is affected only by the number of strings contains in the file to read :

strsize (Ko)load()memreal mem102413Ko3.819ms0.811MB12.188MB32768416Ko43.899ms2.900MB14.273MB2621443.32Mo363.536ms18.650MB30.246MB5242886.65Mo689.840ms36.650MB48.281MB`load()` method is directly affected by this. More strings they are to load, more time we need to load. (logic, anything is magical)

Once the strings are loaded, we have reached the memory used peak.

Reading the data consumes almost no memory.
Only the current line will be loaded into memory.

Read
----

[](#read)

Benchmark with 1024 str :

rows x colscellsreadmemreal mem100 x 44001.152ms0.811MB12.188MB100 x 161 6003.520ms0.811MB12.121MB100 x 323 2007.046ms0.811MB12.262MB100 x 646 40013.758ms0.811MB12.270MB1000 x 44 0009.382ms0.811MB12.203MB1000 x 1616 00032.149ms0.811MB12.129MB1000 x 3232 00065.125ms0.811MB12.203MB1000 x 6464 000136.509ms0.811MB12.320MB10000 x 440 00097.383ms0.811MB12.121MB10000 x 16160 000362.781ms0.811MB12.367MB10000 x 32320 000656.291ms0.811MB12.383MB10000 x 64640 0001 344.341ms0.811MB12.484MB100000 x 4400 000920.734ms0.811MB12.559MB100000 x 161 600 0003 338.086ms0.811MB12.473MB100000 x 323 200 0006 636.691ms0.811MB12.488MB100000 x 646 400 00013 572.875ms0.811MB12.527MBThe reading speed depends on the number of cells to be read. The more cells there are to read, the longer the reading time will be.

**However, the number of cells to be read has no effect on the memory used.**

All bench result
----------------

[](#all-bench-result)

rows x colscellsstrloadreadmemreal mem100 x 440010243.819ms1.152ms0.811MB12.188MB100 x 44003276843.899ms1.308ms2.900MB14.273MB100 x 4400262144363.536ms1.216ms18.650MB30.246MB100 x 4400524288689.840ms1.296ms36.650MB48.281MB100 x 161 60010242.535ms3.520ms0.811MB12.121MB100 x 161 6003276844.586ms3.644ms2.902MB14.180MB100 x 161 600262144347.970ms3.939ms18.652MB30.156MB100 x 161 600524288700.403ms4.054ms36.652MB48.379MB100 x 323 20010242.917ms7.046ms0.811MB12.262MB100 x 323 2003276849.992ms7.068ms2.905MB14.410MB100 x 323 200262144358.629ms7.810ms18.655MB30.160MB100 x 323 200524288720.848ms8.478ms36.655MB48.328MB100 x 646 40010243.175ms13.758ms0.811MB12.270MB100 x 646 4003276844.186ms15.912ms2.914MB14.414MB100 x 646 400262144358.572ms14.553ms18.664MB30.273MB100 x 646 400524288729.723ms19.326ms36.664MB48.250MB1000 x 44 00010242.651ms9.382ms0.811MB12.203MB1000 x 44 0003276850.050ms9.998ms2.900MB14.453MB1000 x 44 000262144347.184ms10.336ms18.650MB30.180MB1000 x 44 000524288707.146ms10.559ms36.650MB48.262MB1000 x 1616 00010242.554ms32.149ms0.811MB12.129MB1000 x 1616 0003276845.078ms33.686ms2.902MB14.309MB1000 x 1616 000262144346.377ms33.933ms18.652MB30.164MB1000 x 1616 000524288695.764ms36.088ms36.652MB48.262MB1000 x 3232 00010242.563ms65.125ms0.811MB12.203MB1000 x 3232 0003276843.847ms66.912ms2.905MB14.434MB1000 x 3232 000262144348.987ms83.518ms18.655MB30.203MB1000 x 3232 000524288690.199ms69.770ms36.655MB48.305MB1000 x 6464 00010242.567ms136.509ms0.811MB12.320MB1000 x 6464 0003276843.872ms141.797ms2.914MB14.453MB1000 x 6464 000262144346.000ms161.795ms18.664MB30.254MB1000 x 6464 000524288681.378ms141.121ms36.664MB48.242MB10000 x 440 00010242.646ms97.383ms0.811MB12.121MB10000 x 440 0003276843.895ms94.159ms2.900MB14.180MB10000 x 440 000262144356.011ms101.299ms18.650MB30.223MB10000 x 440 000524288685.486ms96.134ms36.650MB48.254MB10000 x 16160 00010242.575ms362.781ms0.811MB12.367MB10000 x 16160 0003276847.681ms376.481ms2.902MB14.406MB10000 x 16160 000262144370.344ms365.026ms18.652MB30.230MB10000 x 16160 000524288688.249ms361.975ms36.652MB48.328MB10000 x 32320 00010242.604ms656.291ms0.811MB12.383MB10000 x 32320 0003276848.109ms700.548ms2.905MB14.520MB10000 x 32320 000262144351.243ms708.751ms18.655MB30.309MB10000 x 32320 000524288694.430ms731.479ms36.655MB48.480MB10000 x 64640 00010242.736ms1 344.341ms0.811MB12.484MB10000 x 64640 0003276846.607ms1 374.319ms2.914MB14.520MB10000 x 64640 000262144349.125ms1 371.404ms18.664MB30.297MB10000 x 64640 000524288685.803ms1 439.625ms36.664MB48.387MB100000 x 4400 00010242.986ms920.734ms0.811MB12.559MB100000 x 4400 0003276845.819ms953.416ms2.900MB14.570MB100000 x 4400 000262144351.414ms944.669ms18.650MB30.301MB100000 x 4400 000524288690.455ms970.586ms36.650MB48.305MB100000 x 161 600 00010243.934ms3 338.086ms0.811MB12.473MB100000 x 161 600 0003276843.459ms3 488.664ms2.902MB14.574MB100000 x 161 600 000262144351.500ms3 489.926ms18.652MB30.453MB100000 x 161 600 000524288709.562ms3 513.428ms36.652MB48.477MB100000 x 323 200 00010242.558ms6 636.691ms0.811MB12.488MB100000 x 323 200 0003276843.137ms6 855.266ms2.905MB14.594MB100000 x 323 200 000262144350.783ms7 092.668ms18.655MB30.422MB100000 x 323 200 000524288709.272ms7 187.225ms36.655MB48.496MB100000 x 646 400 00010243.733ms13 572.875ms0.811MB12.527MB100000 x 646 400 0003276845.658ms14 091.011ms2.914MB14.621MB100000 x 646 400 000262144349.527ms14 680.272ms18.664MB30.391MB100000 x 646 400 000524288698.834ms15 201.110ms36.664MB48.473MB

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance41

Moderate activity, may be stable

Popularity34

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~384 days

Total

5

Last Release

456d ago

Major Versions

v1.0.2 → v2.0.x-dev2025-02-17

PHP version history (3 changes)1.0.0PHP &gt;=7.0

v1.0.2PHP ^7.0|^8.0

v2.0.x-devPHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/a9364c697a58ed619a061145dc64c8ee6bbd0536c4594ab3c2b0ffce3e902bc5?d=identicon)[Ark4ne](/maintainers/Ark4ne)

---

Top Contributors

[![Ark4ne](https://avatars.githubusercontent.com/u/6144058?v=4)](https://github.com/Ark4ne "Ark4ne (23 commits)")

---

Tags

performancexlsxcsvreaderlow-memory

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ark4ne-xl-reader/health.svg)

```
[![Health](https://phpackages.com/badges/ark4ne-xl-reader/health.svg)](https://phpackages.com/packages/ark4ne-xl-reader)
```

###  Alternatives

[rap2hpoutre/fast-excel

Fast Excel import/export for Laravel

2.3k24.9M47](/packages/rap2hpoutre-fast-excel)[openspout/openspout

PHP Library to read and write spreadsheet files (CSV, XLSX and ODS), in a fast and scalable way

1.2k57.6M131](/packages/openspout-openspout)[shuchkin/simplexlsx

Parse and retrieve data from Excel XLSx files. MS Excel 2007 workbooks PHP reader.

1.8k3.8M21](/packages/shuchkin-simplexlsx)[sonata-project/exporter

Lightweight Exporter library

44920.9M35](/packages/sonata-project-exporter)[gotenberg/gotenberg-php

A PHP client for interacting with Gotenberg, a developer-friendly API for converting numerous document formats into PDF files, and more!

3685.2M19](/packages/gotenberg-gotenberg-php)[nuovo/spreadsheet-reader

Spreadsheet reader library for Excel, OpenOffice and structured text files

669863.2k8](/packages/nuovo-spreadsheet-reader)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
