Database + XLSX · Imports
Database + XLSX imports 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.
Database + XLSX individual library
Imports examples with copy-ready, production-minded PHP.
Every snippet uses mnb/mnb-phpexcel-database-xlsx 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
- 2
- documented methods
LargeExcelDatabaseImportEngine::importToSql()<?php
declare(strict_types=1);
/*
Summary:
Import one named worksheet with mapping, transactions, duplicate handling, and durable failure
output.
Implementation note:
chunk_size controls worksheet delivery; batch_size controls prepared SQL statements. Tune them
independently.
*/
use Mnb\PHPExcel\Large\LargeExcelDatabaseImportEngine;
$engine = new LargeExcelDatabaseImportEngine();
$result = $engine->importToSql(
__DIR__ . '/orders.xlsx',
$pdo,
'orders',
[
'sheet' => 'Orders',
'with_header' => true,
'chunk_size' => 2_000,
'batch_size' => 500,
'transaction_per_chunk' => true,
'duplicate_strategy' => 'update',
'unique_by' => ['order_id'],
'failed_rows_csv' => __DIR__ . '/storage/orders-failed.csv',
]
);LargeExcelDatabaseImportEngine::importWorkbookToSql()<?php
declare(strict_types=1);
/*
Summary:
Route workbook sheets to separate database tables through one bounded-memory import.
Implementation note:
Use explicit table maps so worksheet names cannot choose arbitrary database destinations.
*/
use Mnb\PHPExcel\Large\LargeExcelDatabaseImportEngine;
$engine = new LargeExcelDatabaseImportEngine();
$result = $engine->importWorkbookToSql(
__DIR__ . '/erp-export.xlsx',
$pdo,
[
'Customers' => 'customers',
'Orders' => 'orders',
'Order Lines' => 'order_lines',
],
[
'chunk_size' => 1_000,
'resume' => true,
]
);No matching example found.Try a method name, task, or result.
Was this guide useful?Use GitHub issues for corrections, missing examples, or unclear behavior.
Open an issue