MNB PHPExcelDeveloper Guide
v2.0.5

Excel example library

Excel patterns you can put into production.

Browse focused PHP examples for reading, structured output, large files, imports, web workflows, testing, workbook generation, formulas, charts, pivots, and security.

92practical examples
21focused categories
5implementation paths
Direct APIExcel formulaPHP preprocessingTrusted templateExternal service

92 visible examples

Reading11 examples
Open category →
Read XLSX rows

Read one worksheet into associative PHP rows while skipping empty records and enforcing a safe row limit.

EasyDirect API
List and select worksheets

Discover worksheet names first, then select a sheet by name instead of relying on workbook order.

EasyDirect API
Detect the header row automatically

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

MediumDirect API
Read selected rows and columns

Limit the source range and project only required worksheet columns before converting rows to PHP arrays.

MediumDirect API
Read cells, formulas, dates, and metadata

Read direct cell values, ranges, calculated formulas, typed cell details, comments, hyperlinks, and worksheet metadata.

AdvancedDirect API
Inspect an XLSX workbook without materializing rows

Inspect file size, encryption state, worksheet metadata, package warnings, and validation errors without converting worksheet cells into a complete PHP array.

EasyDirect API
List worksheets and inspect their dimensions

List worksheet names directly, then inspect visibility, dimensions, declared last rows and columns, and physical row-tag counts.

EasyDirect API
Find inspection metadata for one worksheet

Select one worksheet from the inspection result and read its dimensions, hidden rows and columns, merges, filters, and drawing flags.

MediumDirect API
Count rows without building a complete array

Stream normalized rows through the regular reader and count them without collecting the complete workbook result in memory.

MediumDirect API
Select an optional sheet or use the active sheet

Accept a nullable worksheet input without hiding non-empty typos, then continue with the workbook active sheet when no value was supplied.

EasyDirect API
Check for data rows before collecting an array

Evaluate normalized rows after header and empty-row options, then materialize the result only when data exists.

EasyDirect API
Structured output6 examples
Open category →
Convert a workbook with toStructuredArray()

Return workbook-level source information, every sheet, normalized columns, rows, summaries, warnings, and errors in one PHP array.

EasyDirect API
Return selected-sheet structured output

Return the structured representation for one selected worksheet without wrapping it in a workbook sheets collection.

EasyDirect API
Create flat structured rows

Flatten each structured record while retaining the original physical source row number for validation and error reporting.

MediumDirect API
Return structured JSON from an API

Serialize the full structured workbook directly to compact JSON for a controller or API endpoint without creating a temporary file.

MediumDirect API
Return structured XML from an API

Serialize structured workbook data to XML with a custom root element for integrations that do not consume JSON.

MediumDirect API
Explain total, empty, skipped, and returned row counts

Read structured sheet counts that distinguish logical row positions, physically stored records, sparse gaps, skipped empty records, the header, and final data rows.

MediumDirect API
Large files5 examples
Open category →
Analyze an XLSX before importing

Inspect workbook size, rows, columns, risk, server limits, and the recommended normal or streaming import path before processing.

MediumDirect API
Stream a large XLSX in chunks

Process a large worksheet in bounded-memory chunks and persist each chunk immediately instead of collecting the workbook in one array.

MediumDirect API
Stream only required columns

Reduce parsing and downstream work by projecting worksheet columns while preserving identifiers and converting Excel dates.

MediumDirect API
Stream a large XLSX export

Generate a database-sized XLSX from an iterable while reporting progress and avoiding a full in-memory workbook model.

MediumDirect API
Import to SQL with progress and resume

Stream, validate, batch-insert, record failed rows, checkpoint progress, and resume an interrupted large database import.

AdvancedDirect API
Imports6 examples
Open category →
Preview import quality

Inspect missing columns, unexpected columns, duplicate candidates, empty values, and sample rows before validation or database writes.

EasyDirect API
Suggest a column map

Build an import-screen mapping proposal from source headings, canonical database fields, and known aliases with confidence scores.

MediumDirect API
Validate rows and export failures

Validate imported rows with reusable rules and create a filterable XLSX containing source row numbers and human-readable errors.

MediumDirect API
Detect duplicate records

Find repeated records using one or more business-key columns and report the source row positions involved.

EasyDirect API
Import products and update by SKU

Use the built-in product schema to map aliases, normalize values, validate rows, and update existing records by SKU.

AdvancedDirect API
Generate a validated import template

Create a product import workbook from the same canonical field metadata used by preview and import validation.

EasyDirect API
Web workflows4 examples
Open category →
Testing3 examples
Open category →
Security4 examples
Open category →
Basic9 examples
Open category →
Create a workbook

Create an XLSX workbook from associative PHP rows and use the array keys as the header row.

EasyDirect API
Format cells (font, color, borders)

Apply header styles, range borders, alignment, fills, and number formats without converting numeric values to text.

EasyDirect API
Adjust row height and column width

Set fixed dimensions for predictable layouts and combine them with bounded automatic width calculation.

EasyDirect API
Freeze Panes

Keep headers and identifying columns visible while users scroll through a large worksheet.

EasyDirect API
Sort data

Sort the PHP rows before writing. This produces a workbook whose stored row order already matches the required business order.

EasyPHP preprocessing
Apply Filters

Add an AutoFilter range and optionally preconfigure allowed values for a column.

EasyDirect API
Find & Replace

Apply replacements to selected fields in PHP, then export the transformed rows.

EasyPHP preprocessing
Conditional Formatting

Add value rules, color scales, data bars, or icon sets to make exceptions visible in Excel.

EasyDirect API
Data Validation (Dropdown Lists)

Create a validated dropdown list for a worksheet range and provide useful input and error messages.

MediumDirect API
Formulas6 examples
Open category →
Lookup4 examples
Open category →
Text4 examples
Open category →
Date4 examples
Open category →
Math4 examples
Open category →
Tables2 examples
Open category →
Pivot2 examples
Open category →
Charts4 examples
Open category →
Data4 examples
Open category →
Dashboard3 examples
Open category →
Automation3 examples
Open category →
Printing2 examples
Open category →
Collaboration2 examples
Open category →