Skip to content
MNB PHPExcelDeveloper Guide
AI

Large files

Choose a Large-File Strategy

Select normal reads, streaming sessions, the large reader, or a direct database import based on workload.

Level
Intermediate
Reading time
8 min
Package
mnb/mnb-phpexcel
Updated
Full packageIndividual XLSXLow memory
MnbExcel::analyzeXlsxForImport()recommendImportMethod()autoImportPlan()largeRead()

Use the method advisor#

PHP
$analysis = MnbExcel::analyzeXlsxForImport('orders.xlsx');
$recommendation = MnbExcel::recommendImportMethod('orders.xlsx');
$plan = MnbExcel::autoImportPlan('orders.xlsx');

print_r($analysis);
print_r($recommendation);
print_r($plan);

Use this decision table#

WorkloadRecommended path
Small lookup/configuration workbookMnbExcel::read()->toArray()
Interactive metadata and random cellsNormal ReadSession
One-pass transformationStreaming ReadSession::rows()
Large XLSX importMnbExcel::largeRead()
Large XLSX directly to SQLlargeImportToSql()
Database-sized exportlargeExport() or largeExportFromSql()

Do not use row count alone#

A workbook with 50,000 narrow numeric rows may be cheaper than 5,000 rows containing long shared strings, rich formatting, comments, formulas, or images. Measure row width, shared-string size, sheet count, and the work performed per row.