MNB PHPExcelDeveloper Guide
v2.0.5
XLSX module

XLSX Module

Native XLSX reading, writing, streaming, metadata inspection, formulas, security, and large-file processing.

Updated

LevelAll levelsReading time7 minPackagemnb/mnb-phpexcel
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#

Terminal
composer require mnb/mnb-phpexcel:^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 rowsMnbExcel::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 rowsMnbExcel::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 reportsWorkbookBuilderYou need styles, charts, pivots, validation, images, or protection.
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, report builders, templates, styles, and browser delivery.
Inspection and securityRow counts, encryption, upload controls, and package validation.