PHPackages                             nyx-solutions/yii2-nyx-spreadsheet-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. nyx-solutions/yii2-nyx-spreadsheet-reader

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

nyx-solutions/yii2-nyx-spreadsheet-reader
=========================================

Spreadsheet reader library for Excel, OpenOffice and structured text files. Based on the Martins Pilsetnieks version.

1.0.4(3y ago)0311MITPHPPHP &gt;=5.4.0

Since May 6Pushed 3y ago1 watchersCompare

[ Source](https://github.com/nyx-solutions/yii2-nyx-spreadsheet-reader)[ Packagist](https://packagist.org/packages/nyx-solutions/yii2-nyx-spreadsheet-reader)[ RSS](/packages/nyx-solutions-yii2-nyx-spreadsheet-reader/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (1)Versions (7)Used By (0)

Yii PHP Framework Version 2 / NYX SpreadSheet Reader
====================================================

[](#yii-php-framework-version-2--nyx-spreadsheet-reader)

**spreadsheet-reader** is a PHP spreadsheet reader that differs from others in that the main goal for it was efficient data extraction that could handle large (as in really large) files. So far it may not definitely be CPU, time or I/O-efficient but at least it won't run out of memory (except maybe for XLS files).

So far XLSX, ODS and text/CSV file parsing should be memory-efficient. XLS file parsing is done with php-excel-reader from  which, sadly, has memory issues with bigger spreadsheets, as it reads the data all at once and keeps it all in memory.

Requirements
------------

[](#requirements)

- PHP 5.4.0 or newer
- PHP must have Zip file support (see )

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

- Either run

```
php composer.phar require --prefer-dist "nyx-solutions/yii2-nyx-spreadsheet-reader" "*"
```

or add

```
"nyx-solutions/yii2-nyx-spreadsheet-reader": "*"
```

to the `require` section of your application's `composer.json` file.

Usage
-----

[](#usage)

All data is read from the file sequentially, with each row being returned as a numeric array. This is about the easiest way to read a file:

```
$reader = new SpreadsheetReader('example.xlsx');
foreach ($reader as $row) {
    print_r($row);
}
```

However, now also multiple sheet reading is supported for file formats where it is possible. (In case of CSV, it is handled as if it only has one sheet.)

You can retrieve information about sheets contained in the file by calling the `Sheets()` method which returns an array with sheet indexes as keys and sheet names as values. Then you can change the sheet that's currently being read by passing that index to the `ChangeSheet($Index)` method.

Example:

```
$reader = new SpreadsheetReader('example.xlsx');
$sheets = $reader->Sheets();

foreach ($sheets as $index => $name) {
    echo 'Sheet #'.$index.': '.$name;

    $reader->ChangeSheet($index);

    foreach ($reader as $row) {
        print_r($row);
    }
}
```

If a sheet is changed to the same that is currently open, the position in the file still reverts to the beginning, so as to conform to the same behavior as when changed to a different sheet.

Notes about library performance
-------------------------------

[](#notes-about-library-performance)

- CSV and text files are read strictly sequentially so performance should be O(n);
- When parsing XLS files, all of the file content is read into memory so large XLS files can lead to "out of memory" errors;
- XLSX files use so called "shared strings" internally to optimize for cases where the same string is repeated multiple times. Internally XLSX is an XML text that is parsed sequentially to extract data from it, however, in some cases these shared strings are a problem - sometimes Excel may put all, or nearly all of the strings from the spreadsheet in the shared string file (which is a separate XML text), and not necessarily in the same order. Worst case scenario is when it is in reverse order - for each string we need to parse the shared string XML from the beginning, if we want to avoid keeping the data in memory. To that end, the XLSX parser has a cache for shared strings that is used if the total shared string count is not too high. In case you get out of memory errors, you can try adjusting the *SHARED\_STRING\_CACHE\_LIMIT* constant in SpreadsheetReader\_XLSX to a lower one.

TODOs
-----

[](#todos)

- ODS date formats;

Licensing
---------

[](#licensing)

All of the code in this library is licensed under the MIT license as included in the LICENSE file, however, for now the library relies on php-excel-reader library for XLS file parsing which is licensed under the PHP license.

[![Yii2](https://camo.githubusercontent.com/d6b0929173e28cc627430d2519ca1853466a70f37395877eaf4820cb3e1e1909/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f506f77657265645f62792d5969695f4672616d65776f726b2d677265656e2e7376673f7374796c653d666c6174)](https://camo.githubusercontent.com/d6b0929173e28cc627430d2519ca1853466a70f37395877eaf4820cb3e1e1909/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f506f77657265645f62792d5969695f4672616d65776f726b2d677265656e2e7376673f7374796c653d666c6174)

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 80% 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 ~443 days

Recently: every ~554 days

Total

6

Last Release

1440d ago

Major Versions

0.5.11 → 1.0.02016-05-06

### Community

Maintainers

![](https://www.gravatar.com/avatar/f7c641a4199171cc30bf08b9bf67636a8463acf86813fa259aab131b5bd5a161?d=identicon)[nyx-solutions](/maintainers/nyx-solutions)

---

Top Contributors

[![jsas4coding](https://avatars.githubusercontent.com/u/4156892?v=4)](https://github.com/jsas4coding "jsas4coding (8 commits)")[![brenoherculano](https://avatars.githubusercontent.com/u/90738807?v=4)](https://github.com/brenoherculano "brenoherculano (2 commits)")

---

Tags

excelxlsxlsxcsvspreadsheetodsyii2extensionOpenOffice

### Embed Badge

![Health badge](/badges/nyx-solutions-yii2-nyx-spreadsheet-reader/health.svg)

```
[![Health](https://phpackages.com/badges/nyx-solutions-yii2-nyx-spreadsheet-reader/health.svg)](https://phpackages.com/packages/nyx-solutions-yii2-nyx-spreadsheet-reader)
```

###  Alternatives

[phpoffice/phpspreadsheet

PHPSpreadsheet - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine

13.9k293.5M1.3k](/packages/phpoffice-phpspreadsheet)[nuovo/spreadsheet-reader

Spreadsheet reader library for Excel, OpenOffice and structured text files

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

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

1.1k57.6M131](/packages/openspout-openspout)[kartik-v/yii2-export

A library to export server/db data in various formats (e.g. excel, html, pdf, csv etc.)

1623.1M35](/packages/kartik-v-yii2-export)[seine/seine

Seine - Write spreadsheets of various formats to a stream

1270.3k](/packages/seine-seine)

PHPackages © 2026

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