PHPackages                             otzy/spreadsheet2array - 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. otzy/spreadsheet2array

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

otzy/spreadsheet2array
======================

Extracts tables from spreadsheet to PHP array

v1.0.3(9y ago)093MITPHP &gt;=5.6.0

Since Jun 26Compare

[ Source](https://github.com/otzy/spreadsheet2array)[ Packagist](https://packagist.org/packages/otzy/spreadsheet2array)[ RSS](/packages/otzy-spreadsheet2array/feed)WikiDiscussions Synced yesterday

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

spreadsheet2array
=================

[](#spreadsheet2array)

Easy to use PHPExcel wrapper. If you are developing any sort of import from spreadsheets, this library will help you to import spreadsheet into php array. You can import from xls, xlsx, ods or whatever else PHPExcel supports or will support.

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

[](#installation)

composer require otzy/spreadsheet2array

How to use
----------

[](#how-to-use)

### Import table with column names

[](#import-table-with-column-names)

```

\Otzy\Spreadsheet2Array::readTable($file_name, $type = 'auto', $sheet = false, $first_row = 0, $first_col = 0,
                                                                         $col_names = false, $check_col_names = false)

```

yes, many parameters, but usage is really simple. Lets say you have a spreadsheet like the following one (column and row labels are not shown):

onetwothree123456your code will be:

```

$my_table = \Otzy\Spreadsheet2Array::readTable('path_to_your_file', 'auto', false, 0, 0, ['one', 'two', 'three']);

//$my_table will contain two dimensional array:
[
 ['one'=>1, 'two'=>2, 'three'=>3],
 ['one'=>1, 'two'=>2, 'three'=>3]
]

```

If you don't need all columns, list only those that you need:

```

$my_table = \Otzy\Spreadsheet2Array::readTable('path_to_your_file', 'auto', false, 0, 0, ['one', 'three']);

//$my_table will contain two dimensional array:
[
 ['one'=>1, 'three'=>3],
 ['one'=>1, 'three'=>3]
]

```

The presence of required field names is always checked. If at least one field is missing, Spreadsheet2ArrayException will be thrown.

###### The complete description of all parameters:

[](#the-complete-description-of-all-parameters)

```
     * @param string $file_name name of file to read
     * @param string $type 'auto', 'csv', 'xls', 'xlsx', 'ods'
     *
     * @param bool|string|int $sheet Sheet Name/Index to read.
     * Index must be passed as an integer. Sheets are zero-based. I.e. first sheet has index=0
     * If false read active sheet. This is normally the sheet, that was active at the moment of Save in Excel or Open Office
     * Not applicable for csv
     *
     * @param int $first_row first row to read (zero based).
     *
     * @param int $first_col first column to read (zero based).
     *
     * @param string[]|bool $col_names array of field names or false to use $firstRow for field names
     *
     * @param bool $check_col_names Parameter works only when $col_names !== false.
     * If true - check that column names and the order of names are exactly the same as value and order of cells in the first row.
     * If false - only check that all $col_names are represented in the first row
     *

```

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity61

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 ~111 days

Total

4

Last Release

3323d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/11853333?v=4)[Evgeny Mazovetskiy](/maintainers/otzy)[@otzy](https://github.com/otzy)

---

Top Contributors

[![otzy](https://avatars.githubusercontent.com/u/11853333?v=4)](https://github.com/otzy "otzy (15 commits)")

---

Tags

excelxlscsvspreadsheetodslibre officeopen officexslx

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/otzy-spreadsheet2array/health.svg)

```
[![Health](https://phpackages.com/badges/otzy-spreadsheet2array/health.svg)](https://phpackages.com/packages/otzy-spreadsheet2array)
```

###  Alternatives

[phpoffice/phpspreadsheet

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

14.3k318.2M1.5k](/packages/phpoffice-phpspreadsheet)[openspout/openspout

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

1.2k70.2M229](/packages/openspout-openspout)[nuovo/spreadsheet-reader

Spreadsheet reader library for Excel, OpenOffice and structured text files

671891.8k8](/packages/nuovo-spreadsheet-reader)[dcat/easy-excel

使用简单实用的语义化接口快速读写Excel文件

161390.7k28](/packages/dcat-easy-excel)[avadim/fast-excel-reader

Lightweight and very fast XLSX Excel Spreadsheet and CSV Reader in PHP

107737.8k10](/packages/avadim-fast-excel-reader)[jgrygierek/batch-entity-import-bundle

Importing entities with preview and edit features for Symfony.

101.1M1](/packages/jgrygierek-batch-entity-import-bundle)

PHPackages © 2026

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