MNB PHPExcelDeveloper Guide
XLSX library

Standalone PHP XLSX Library

Install and use the standalone PHP XLSX library for native reading, writing, streaming, metadata inspection, formulas, security, and large-file processing.

Updated

LevelAll levelsReading time7 minPackagemnb/mnb-phpexcel-xlsx
Xlsx::read()Xlsx::write()ReadSession::inspect()ReadSession::countRows()

What you will learn

  • Install the standalone native XLSX library 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#

Terminal
composer require mnb/mnb-phpexcel-xlsx:^2.0

The 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#

TaskPrimary APIUse it when
Read normalized rowsXlsx::read()You need headers, projection, ranges, chunks, validation, or structured output.
Read one value or rangeXlsx::cell() / Xlsx::rangeValues()The workbook behaves like a lookup document.
Inspect without materializing rowsXlsx::read(...)->inspect() / sheetNames()You need upload previews, sheet dimensions, warnings, or sheet names first.
Write a simple workbookXlsx::write()Rows and basic writer options are sufficient.
Build rich workbooksWorkbookData + XlsxWriterYou need explicit styles, charts, pivots, validation, images, or protection definitions.
Process very large filesLargeXlsxReadSessionBounded 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#

GuideFocus
Quick startRead, create structured output, and write a workbook.
Reading XLSXSessions, sheets, headers, formulas, metadata, and projection.
Writing XLSXSimple writes, workbook data, templates, styles, and encryption.
Inspection and securityRow counts, encryption, upload controls, and package validation.