Skip to content
MNB PHPExcelDeveloper Guide
AI

Versions

Version 2.0.3 Documentation Notes

Discover and select the active worksheet, check optional sheet names, and test normalized data rows after header and empty-row options.

Level
All levels
Reading time
7 min
Package
mnb/mnb-phpexcel-core and xlsx
Updated
Core 2.0.3+XLSX 2.0.3+
Available sincev2.0.3Last API changev2.0.3Version guide
Release context

v2.0.3 in the MNB PHPExcel v2 release line.

Active-sheet discovery, safe optional sheet selection, and normalized row-state helpers enter the v2 maintenance line.

Status
Maintenance
Package
mnb/mnb-phpexcel-core and xlsx
Introduced
v2.0.3
Sheet utilities

Discover a worksheet safely, then test normalized data instead of raw workbook structure.

v2.0.3 adds active-sheet discovery, optional sheet lookup, and row-state helpers that operate after header and empty-row rules are applied.

Safe worksheet selection
PHP
$workbook = MnbExcel::read($path);

$sheet = $workbook->sheetIfExists('Orders')
    ?? $workbook->activeSheet();

$session = $sheet->withHeaderRow(1);

if ($session->isEmpty()) {
    echo 'No data rows found.';
}
activeSheetName()
Discover the workbook active-sheet name.
sheetIfExists()
Check optional worksheet input without forcing an exception.
isEmpty()
Test whether normalized data rows remain after session options.
hasRows()
Use the positive row-presence check when that reads more naturally in application logic.
Continue reading

Use the row-count guide for complete selection and normalized-row behavior.

The detailed reading guide covers active sheets, explicit sheet names, headers, and row-count semantics together.

Sheet selection and row countsSee the complete worksheet-selection and row-state workflow.
Open sheet utilities and row counts →