avadim / fast-excel-reader
Lightweight streaming XLSX, XLSM, XLS, ODS and CSV spreadsheet reader for PHP
Requires
- php: >=7.4
- ext-ctype: *
- ext-dom: *
- ext-mbstring: *
- ext-xmlreader: *
- ext-zip: *
- avadim/fast-excel-helper: ^1.4
Requires (Dev)
- phpunit/phpunit: ^9.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
- dev-main
- v5.0.0
- v4.5.0
- v4.4.3
- v4.4.2
- v4.4.1
- v4.4.0
- v4.3.0
- v4.2.0
- v4.1.0
- v4.0.1
- v4.0.0
- v3.2.0
- v3.1.0
- v3.0.3
- v3.0.2
- v3.0.1
- v3.0.0
- v2.30.0
- v2.29.1
- v2.29.0
- v2.28.1
- v2.28.0
- v2.27.0
- v2.26.2
- v2.26.1
- v2.26.0
- v2.25.1
- v2.25.0
- v2.24.0
- v2.23.0
- v2.22.1
- v2.22.0
- v2.21.1
- v2.21.0
- v2.20.0
- v2.19.0
- v2.18.2
- v2.18.1
- v2.18.0
- v2.17.1
- v2.17.0
- v2.16.0
- v2.15.5
- v2.15.4
- v2.15.3
- v2.15.2
- v2.15.1
- v2.15.0
- v2.14.2
- v2.14.1
- v2.14.0
- v2.12.0
- v2.11.0
- v2.10.0
- v2.9.2
- v2.9.1
- v2.9.0
- v2.8.4
- v2.8.3
- v2.8.2
- v2.8.1
- v2.8.0
- v2.7.0
- v2.6.0
- v2.5.0
- v2.4.2
- v2.4.1
- v2.4.0
- v2.3.2
- v2.3.1
- v2.3.0
- v2.2.5
- v2.2.4
- v2.2.3
- v2.2.0
- v2.1.2
- v2.1.1
- v2.1.0
- v2.0.2
- v2.0.1
- v2.0.0
- v1.4.2
- v1.4.1
- v1.4.0
- v1.3.4
- v1.3.3
- v1.3.2
- v1.3.1
- dev-feature/5.0-ods
- dev-dev
- dev-skipRows
This package is auto-updated.
Last update: 2026-11-13 17:03:28 UTC
README
FastExcelReader
π¬π§ English Β· π·πΊ Π ΡΡΡΠΊΠΈΠΉ
FastExcelReader is a part of the FastExcelPhp Project which consists of
- FastExcelWriter - to create Excel spreadsheets
- FastExcelReader - to reader Excel spreadsheets and CSV-files
- FastExcelTemplator - to generate Excel spreadsheets from XLSX templates
- FastExcelLaravel - special Laravel edition
Introduction
This library is designed to be lightweight, super-fast and requires minimal memory usage.
FastExcelReader reads XLSX, XLSM, XLTX, XLTM, legacy XLS (BIFF8), ODS and CSV. It only reads data, but it does it very quickly and with minimal memory usage.
Features
XLSX format support
- Supports XLSX format (Office 2007+) with multiple worksheets
- Supports autodetect currency/numeric/date types
- Supports auto formatter and custom formatter of datetime values
- The library can define and extract images from XLSX files
- The library can read styling options of cells - formatting patterns, colors, borders, fonts, etc.
XLS format support
- Supports legacy XLS format (Office 97-2003, BIFF8) with the same API as XLSX
- Values, dates, cell styles, formula text and images are all returned in the same shape
- The format is chosen by the file signature, not by the extension
- Streaming row iteration; workbook metadata, shared strings and images still consume memory
ODS format support
- Streaming values, areas, headers, merged ranges and cached formula results.
- ODS capabilities and limitations.
CSV format support
- Openable via
Excel::open()as a normal one-sheet workbook with the same reading API as XLSX/XLS, or viaExcel::openCsvReader()for the low-level engine - Delimiter Detection: Automatic detection or manual specification of column delimiters.
- Wide Encoding Support: Any encoding supported by your PHP environment
- Supports fields with or without quotes, and escaped quotes (doubled quotes).
- Multi-line Fields Handles line breaks within quoted fields.
- Two modes - strict (follows RFC 4180) and tolerant (with non-standard CSV files)
Installation
Use composer to install FastExcelReader into your project:
composer require avadim/fast-excel-reader
Quick start
use \avadim\FastExcelReader\Excel; // XLSX, legacy XLS and CSV are all opened this way; the reader is chosen by the file signature $excel = Excel::open(__DIR__ . '/files/demo.xlsx'); // Read all rows into a two-dimensional array (ROW x COL) $rows = $excel->readRows(); // Or read row by row (memory efficient) $sheet = $excel->sheet(); foreach ($sheet->nextRow() as $rowNum => $rowData) { // handle $rowData }
See more in the Getting Started guide.
Choosing an opening method
In 5.0, Excel is an opening facade; XML books use XlsxBook. See migration.
| Method | Returns | Use |
|---|---|---|
| Excel::open($file, $options) | AbstractBook | Detect XLSX-family/XLS/ODS/CSV by content |
| Excel::openXlsx($file) | XlsxBook | Require XLSX, XLSM, XLTX or XLTM |
| Excel::openXls($file) | XlsBook | Require BIFF8 XLS |
| Excel::openOds($file) | OdsBook | Require ODS |
| Excel::openCsv($file, $options) / openCsvBook() | CsvBook | Common book/sheet API |
| Excel::openCsvReader($file, $options) | CsvReader | Low-level CSV engine |
CSV options accept an array, CsvOptions or null. Explicit CSV factories accept empty files; generic open() rejects empty input. Only ['format' => 'csv'] forces the format in open(). For low-level getCsvLine()/fromRow(), use openCsvReader() or the existing CSV book's getReader().
isXlsx() checks supported XML workbook package parts and content types; a ZIP signature alone is insufficient. isOds() checks the ODS MIME entry; isXls() checks the OLE2 signature. validate() checks required XML-book/ODS parts and XML well-formedness, not schemas or formula calculations. Macros are never executed. Templates are read as saved documents.
Call $book->close() in finally to release handles and owned temporary files. Closing is irreversible and idempotent; new reads and resuming a suspended row iterator throw an exception. Caller-owned input streams remain open.
Format capabilities and resource limits
| Capability | XLSX family | XLS (BIFF8) | ODS | CSV |
|---|---|---|---|---|
| Common API and row generators | Yes | Yes | Yes | Yes, one sheet |
| Styles / images | Yes | Format limitations | Not in initial reader | No |
| Formula text / cached results | Read / read | Supported subset / read | No / read | Plain text |
| Hyperlinks / document properties | Yes | Not exposed | Not exposed | No |
| Encoding | XML | BIFF/codepage | XML | Automatic or explicit |
readRows() collects the result in memory; use nextRow() for large imports.
Shared strings are loaded into memory for XLSX and XLS, and XLS also loads its global
image store. Streaming rows therefore does not imply constant memory for the whole workbook.
openString() and openStream() copy input to disk. Call close() to remove their owned temporary files promptly; shutdown cleanup remains a fallback.
Documentation
Guides
-
Getting Started β read cells, rows and columns
-
Reading Data β row by row, array keys, empty cells & rows
-
Advanced Reading β read areas, defined names, callbacks
-
Cell Styles β read complete style info of cells
-
Images β extract images from XLSX
-
Sheet Metadata β data validation, column widths, row heights, freeze pane, tab color, merged cells, dimensions
-
CSV Parsing β reading CSV files
-
XLS (Excel 97-2003) β reading legacy XLS workbooks
API Reference
Examples
You can find more examples in the /demo folder.
Changelog
See CHANGELOG.md for the list of changes.
Do you want to support FastExcelReader?
if you find this package useful you can give me a star on GitHub.
Or you can donate me :)
- USDT (TRC20) TSsUFvJehQBJCKeYgNNR1cpswY6JZnbZK7
- USDT (ERC20) 0x5244519D65035aF868a010C2f68a086F473FC82b
- ETH 0x5244519D65035aF868a010C2f68a086F473FC82b