PHP 8.1+ · Open source · Spreadsheet library
MNB PHPExcel — modern spreadsheet tools for PHP.
MNB PHPExcel reads, writes, validates and streams XLSX, XLS, CSV/TSV, JSON, XML and ODS from one PHP 8.1+ API. Use the full package for mixed-format workflows and database imports, or install a focused package when one format owns the job.
- Large-file streamingForward-only reads and chunked processing.
- Validation & importsInspect uploads before application or PDO writes.
- Modular packagesInstall the toolkit or only the format you need.
composer require mnb/mnb-phpexcel:^2.0
MNB PHPExcel
Where to start
Choose the path that matches the job in front of you. Each guide starts with working code and stays focused on one spreadsheet workflow.
Build an XLSX report
Create a workbook from PHP data, add formulas and formatting, then save it or send it to the browser.
Create a workbook → Large filesProcess a large workbook
Read forward, select only the columns you need and hand rows to application code in manageable chunks.
Open streaming guide → Data integrityAccept spreadsheet uploads
Validate the file, confirm the sheet and headers, preview the import and write through PDO deliberately.
Open upload recipe → MigrationMove off legacy PHPExcel
Map familiar workbook patterns to the current API without treating the two libraries as drop-in compatible.
Read migration guide → Modular installExplore packages
Use the complete toolkit for mixed workflows, or install a focused package when one format owns the job.
Compare packages →A small example
The API keeps the important steps visible.
Select the workbook, choose the worksheet, declare where the headers live, then iterate records. The example is intentionally ordinary: application code should be easy to read six months later.
<?php
require __DIR__ . '/vendor/autoload.php';
use Mnb\PHPExcel\MnbExcel;
$orders = MnbExcel::read('orders.xlsx')
->sheet('Orders')
->withHeaderRow(1);
foreach ($orders->rows() as $row) {
echo $row['Order ID'] . ' — ' . $row['Customer'] . PHP_EOL;
}Packages
Choose the right package in a clean, easy-to-scan format.
mnb/mnb-phpexcel is the practical default when an application touches several formats. Pick a focused package when one format or one import responsibility has a clear boundary.
Use when one application spans multiple spreadsheet formats.
Whole toolkit for apps that touch several formats, reports, imports and database workflows.
mnb/mnb-phpexcel:^2.0For modern .xlsx reports and imports.
Native Excel 2007+ reading and writing with streaming, formulas, styling and workbook protection.
mnb/mnb-phpexcel-xlsx:^2.0For older .xls spreadsheets still in use.
Support classic Excel 97–2003 workbooks through BIFF8 and OLE/CFB readers and writers.
mnb/mnb-phpexcel-xls:^2.0For delimited data exchange and pipelines.
Low-memory CSV and TSV handling with delimiter control, encoding conversion and output safeguards.
mnb/mnb-phpexcel-csv:^2.0For API-facing data and line streams.
Read and write JSON arrays, workbook-shaped documents, JSON Lines and NDJSON streams.
mnb/mnb-phpexcel-json:^2.0For XML feeds and mapped imports.
Secure, forward-only XML processing with explicit mapping and configurable structured output.
mnb/mnb-phpexcel-xml:^2.0For LibreOffice and ODS workflows.
OpenDocument spreadsheet support with worksheet selection, column projection, dates and formulas.
mnb/mnb-phpexcel-ods:^2.0For database-first spreadsheet imports.
Map and validate iterable rows before batched PDO inserts, updates and failed-row reporting.
mnb/mnb-phpexcel-database:^2.0For heavy XLSX-to-database jobs.
Stream very large XLSX worksheets directly into PDO with chunks, manifests and failure output.
mnb/mnb-phpexcel-database-xlsx:^2.0Before you choose a package
A few details that affect real projects.
These are the questions that usually change an implementation choice. The answers are intentionally short; the reference pages carry the edge cases.
Do I need the complete package?
Not always. Use the complete package when one application works across several formats or combines spreadsheet handling with database imports. A focused package is a better fit for a service that only owns one format.
How are formulas handled?
Writers can create formula cells. Readers can expose formula expressions and, where the format supports it, calculated or cached results. Unsupported calculations should fall back to cached values or an application-specific calculation step rather than being guessed.
Can the database layer stay separate from file parsing?
Yes. The Database package works with mapped iterable rows, so validation and PDO logic do not have to depend on a particular spreadsheet format. Database XLSX is available when the job is specifically a large XLSX-to-PDO pipeline.
Is migration from the old PHPExcel project automatic?
No. The current API is designed for PHP 8.1+ and does not pretend to be a drop-in compatibility layer. Existing code should be migrated by mapping workbook, reader and writer responsibilities explicitly.