MNB PHPExcelDeveloper Guide
DB + XLSX library

Resume, Progress, and Failed Rows

Persist large XLSX import checkpoints, resume safely, report invalid source rows, and design idempotent replay behavior.

Updated

LevelAdvancedReading time10 minPackagemnb/mnb-phpexcel-database-xlsx
LargeImportManifestLargeFailedRowsCsvWriterprogress

What you will learn

  • Resume from the last committed source row.
  • Keep invalid rows available for correction and re-upload.
  • Prevent duplicate data when a chunk is replayed.

Make replay safe#

  • Create a stable database unique index for the business key.
  • Use duplicate_strategy=skip or update when replay is possible.
  • Keep the source workbook unchanged while its manifest remains active.
  • Store the manifest and failed-row CSV outside the public web root.
  • Delete or archive the manifest only after the import is conclusively complete.

Use progress as observability#

PHP
$result = $engine->importToSql($path, $pdo, 'orders', [
    'progress' => static function (array $state): void {
        printf(
            "Rows: %d | Inserted: %d | Failed: %d\n",
            $state['rows_scanned'] ?? 0,
            $state['inserted_rows'] ?? 0,
            $state['failed_rows'] ?? 0,
        );
    },
]);

Preserve original row numbers#

The integration keeps physical worksheet row numbers in validation and failed-row output so uploaders can correct the exact row in the source workbook.