MNB PHPExcelDeveloper Guide

XLS · Reading

XLS reading examples.

Package-local, copy-ready examples organized like the classes and methods reference. Open one example at a time, search by method, and jump from the right-side index.

Packagemnb/mnb-phpexcel-xls:^2.0Reference2 examples · 5 methods
XLS individual library

Reading examples with copy-ready, production-minded PHP.

Every snippet uses mnb/mnb-phpexcel-xls or its declared Core dependency. Each copied snippet includes strict typing, a concise summary, implementation guidance, readable limits, and a safe fixture check.

2
examples
5
documented methods
Example 01

Read associative rows from XLS

Open related guide
Xls::read()sheet()withHeaderRow()rows()
read-associative-rows-from-xls.php
<?php

declare(strict_types=1);

/*
Summary:
    Stream a named BIFF8 worksheet as associative rows with upload-friendly limits.

Implementation note:
    The native reader handles OLE/CFB and BIFF8 directly. Keep application upload limits lower than
    parser safety limits.
*/

use Mnb\PHPExcel\Format\Xls;

foreach (Xls::read(__DIR__ . '/customers.xls')
    ->sheet('Customers')
    ->withHeaderRow(1)
    ->rows([
        'skip_empty_rows' => true,
        'max_rows' => 5_000,
    ]) as $row) {
    echo $row['Name'] . PHP_EOL;
}