MNB PHPExcelDeveloper Guide

XLSX example reference

Standalone XLSX examples for modern Excel workbooks.

Read, inspect, stream, write, and protect .xlsx files through the package-local Xlsx facade and the shared Core read session.

Packagemnb/mnb-phpexcel-xlsx:^2.0Reference32 examples · 81 methods
Showing selected library

XLSX examples

Read, inspect, stream, write, and protect .xlsx files through the package-local Xlsx facade and the shared Core read session.

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

Library guide →Classes and methods →

Reading28 examples
Open category →
Read XLSX rows with headers

Open an XLSX workbook, select a worksheet, map row one to associative keys, and collect bounded rows.

Open XLSX with reusable reader options

Create a read session with typed options, inspect the effective configuration, and switch between normal and streaming modes.

Read one cell with the XLSX facade

Use the focused static shortcut when the application needs a single cell rather than a reusable read session.

Read an XLSX range directly

Return a rectangular cell range from one worksheet through the standalone XLSX facade.

Read typed cell details and rich text

Inspect formula, cached value, comments, hyperlinks, number format, and rich-text runs for selected XLSX cells.

Read worksheet images and protection

Read drawing metadata and worksheet protection settings without first collecting tabular rows.

Check XLSX encryption before reading

Detect password-to-open encryption and report the Office encryption mode before creating a read session.

Inspect an XLSX workbook without rows

Inspect package status, file size, encryption, worksheet dimensions, warnings, and validation errors without materializing rows.

List and strictly select worksheets

Discover sheet names first, then select a required worksheet by name or one-based index.

Read active worksheet identity

Read the workbook active-sheet name, one-based index, and complete active-sheet metadata.

Check whether a worksheet exists

Check a worksheet name or one-based index without selecting it or throwing for a missing optional sheet.

Select an optional worksheet safely

Return a selected read session when a sheet exists and null when an optional worksheet is absent.

Use a requested sheet or the active sheet

Use the active worksheet only when the requested value is null or empty while keeping non-empty typos strict.

Select the active worksheet explicitly

Create a read session targeting the workbook active worksheet through either supported fluent method.

Inspect worksheet dimensions and flags

Find one worksheet in inspection metadata and read dimensions, hidden rows and columns, merges, filters, and drawing flags.

Count rows across every worksheet

List worksheets and count normalized data rows for each one without building complete PHP arrays.

Detect the header row automatically

Inspect a messy worksheet, report the likely header row and confidence, then apply semantic header detection.

Choose an explicit header strategy

Compare physical-row, data-row, first-non-empty, enabled, and disabled header mappings on cloned read sessions.

Read selected rows and columns

Constrain the source range, project worksheet columns before parsing, and select normalized header keys afterward.

Check and require data rows

Check whether normalized data exists and enforce a required-row contract before terminal conversion.

Read first row, row states, and all rows

Preview the first normalized row, count the selection, inspect row-state metadata, and iterate records lazily.

Stream XLSX chunks with progress and row errors

Process bounded batches, report progress, choose a row-error policy, and inspect normalized row errors.

Read cells, ranges, and formulas from one session

Reuse one selected worksheet for direct cells, multiple coordinates, rectangular ranges, and calculated formula values.

Read cell details, styles, and rich text

Read a typed cell snapshot, one cell style, a range of styles, and rich-text runs from the selected worksheet.

Read and extract worksheet images

Inspect worksheet drawing metadata or extract embedded images to a controlled destination directory.

Read worksheet metadata and protection

Read worksheet-level metadata and editing-protection settings from one selected XLSX sheet.

Build structured sheet and workbook arrays

Return structured payloads for the selected sheet, the complete workbook, or an automatically selected scope.

Convert or save XLSX rows as JSON and XML

Convert normal or structured read results to JSON/XML strings or save them directly to application-owned files.

Large files1 examples
Open category →
Structured output1 examples
Open category →
Basic1 examples
Open category →
Security1 examples
Open category →