Choose a Large-File Strategy
Select normal reads, streaming sessions, the large reader, or a direct database import based on workload.
Updated
MnbExcel::analyzeXlsxForImport()recommendImportMethod()autoImportPlan()largeRead()What you will learn
- Choose an API based on row count, row width, formulas, and memory.
- Run preflight analysis before expensive imports.
- Know when direct database import is preferable to a row array.
Use the method advisor#
$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#
| Workload | Recommended path |
|---|---|
| Small lookup/configuration workbook | MnbExcel::read()->toArray() |
| Interactive metadata and random cells | Normal ReadSession |
| One-pass transformation | Streaming ReadSession::rows() |
| Large XLSX import | MnbExcel::largeRead() |
| Large XLSX directly to SQL | largeImportToSql() |
| Database-sized export | largeExport() 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.
Was this guide useful?Use GitHub issues for corrections, missing examples, or unclear behavior.
Open an issue