Reporting CSV Import Results
An administrator needs evidence of what happened, not just “upload complete”.
Report useful totals
Show the escaped filename, rows read, inserted, updated, skipped and rejected, plus row-specific validation messages and whether a transaction committed or rolled back.
$summary = [
"read" => $rowsRead,
"inserted" => $rowsInserted,
"rejected" => count($rowErrors)
];
Totals must reconcile: rows read equals all outcome categories combined. Never display passwords, server paths or raw SQL errors.
Accessible output
Use a clear heading and a list or table. Do not communicate success through colour alone. Make corrective messages specific: include the CSV row number and violated rule.
Check
- Totals match database records.
- Both success and failure cases are tested.
- Messages help the administrator correct the file.
- Sensitive technical details remain hidden.