XLSX Module
Native XLSX reading, writing, streaming, metadata inspection, formulas, security, and large-file processing.
Updated
MnbExcel::read()Xlsx::write()ReadSession::inspect()ReadSession::countRows()What you will learn
- Install the native XLSX module without unrelated formats.
- Choose between row sessions, direct cell access, lightweight inspection, and streaming APIs.
- Find the deeper guide for writing, security, formulas, or large files.
Install the XLSX package#
composer require mnb/mnb-phpexcel:^2.0The package requires PHP 8.1+, ext-iconv, and ext-openssl. Native ZIP and XMLReader extensions are recommended for the fastest, lowest-memory package access.
Choose the right entry point#
| Task | Primary API | Use it when |
|---|---|---|
| Read normalized rows | MnbExcel::read() | You need headers, projection, ranges, chunks, validation, or structured output. |
| Read one value or range | Xlsx::cell() / Xlsx::rangeValues() | The workbook behaves like a lookup document. |
| Inspect without materializing rows | MnbExcel::read(...)->inspect() / sheetNames() | You need upload previews, sheet dimensions, warnings, or sheet names first. |
| Write a simple workbook | Xlsx::write() | Rows and basic writer options are sufficient. |
| Build rich reports | WorkbookBuilder | You need styles, charts, pivots, validation, images, or protection. |
| Process very large files | LargeXlsxReadSession | Bounded memory, progress, resume, or database ingestion matters. |
Supported capability areas#
- Worksheet selection, header detection, ranges, projection, formulas, dates, styles, comments, hyperlinks, images, and protection metadata.
- Native XLSX creation with formatting, validation, charts, pivot definitions, workbook protection, worksheet protection, and password encryption.
- Lightweight file and sheet information without hydrating cell rows.
- Streaming reads and writes with shared-string strategies, progress callbacks, row errors, preflight analysis, and compatibility validation.
Continue through the XLSX guide#
| Guide | Focus |
|---|---|
| Quick start | Read, create structured output, and write a workbook. |
| Reading XLSX | Sessions, sheets, headers, formulas, metadata, and projection. |
| Writing XLSX | Simple writes, report builders, templates, styles, and browser delivery. |
| Inspection and security | Row counts, encryption, upload controls, and package validation. |
Was this guide useful?Use GitHub issues for corrections, missing examples, or unclear behavior.
Open an issue