Laravel CSV import failing: how I trace rejected and missing rows
Laravel CSV import failing or missing records? How I check parsing, mapping, validation and repeat uploads before scoping a reliable import workflow.

A supplier sends a CSV file, your team uploads it to the Laravel application, and the import fails. Perhaps some rows are rejected. Perhaps it says “complete” but the expected stock or customer records are missing. Someone opens the file in Excel, makes a few guesses and uploads it again.
That is how a small import problem becomes an unreliable business process. When I investigate a failing Laravel CSV import, I follow a sample record from the original file through parsing, mapping, validation and saving. I also check what a second upload will do before anyone tries it on live data.
Separate a failed upload from a failed import
I would first establish which stage failed. Did the application receive the file? Did it start reading records? Did validation reject them? Did processing stop during a database write?
A useful investigation starts with the import's time, any job or batch identifier, its reported outcome and the corresponding application logs. If processing runs in the background, I would check its actual completion rather than treat “upload accepted” as “data imported”. My article on stuck Laravel queues covers that separate part of the journey.
I would keep an untouched copy of the original file. Repeatedly opening and resaving the only copy makes it harder to tell whether the source data or a later edit caused the problem.
Check the CSV structure before changing the rows
I would inspect the file as data, not just how it looks in a spreadsheet. Which separator does it use? Are the headers where the importer expects them? Are quoted fields being read correctly?
A comma inside a quoted address is part of that field, not necessarily another column. Quoted fields can also contain line breaks. RFC 4180 describes these common CSV conventions. A file extension alone does not tell me whether a supplier's export follows them.
PHP provides a CSV-aware reader with separator and enclosure settings, documented in the fgetcsv reference. If the application instead splits every line on commas, I would test it against fields containing commas and quotes.
I would compare a rejected record with a valid one after parsing. The relevant question is whether the importer sees the intended columns and values. I would also check the expected character encoding if names or header text are being read incorrectly.
Make column mapping explicit
A file can be readable and still map to the wrong business fields. I would inspect whether the importer matches headers by name or assumes a fixed column order.
If a supplier inserts a new column near the beginning, a position-based mapping could read a different value into every field after it. Renaming a header may instead leave a required field unmapped. Those are scenarios I would test against the actual importer, not conclusions based on its error message.
The preview should show the source header, destination field and a sample value before changes are committed. Missing required columns should produce a clear explanation. Unexpected columns should have a defined handling rule.
I would also identify the stable key used to match existing records. A display name is not automatically a reliable product or customer identifier.
Is your team repairing every CSV by hand?
Tell me which system produces the file, what the import should do and where it fails. I can scope a focused review of the Laravel workflow.
Discuss your import problem with Adam
Preserve identifiers and agree the data formats
Product codes and account references may look numeric without being quantities. I would check that leading zeros and long identifiers survive the export, any spreadsheet editing and the application import.
Microsoft documents Excel's handling of leading zeros and large numbers. If an earlier step has already altered an identifier, changing the Laravel validator will not recover the original value.
Dates, decimal values and blank cells need an agreed interpretation too. Does a blank stock field mean “leave unchanged” or “set to zero”? Does a date use day-first or month-first ordering? Does a price include a currency symbol?
I would establish these rules with the people responsible for the data. Silently guessing can make an import look successful while storing the wrong result.
Give rejected rows an actionable explanation
Laravel supports validation rules for incoming data, arrays and nested values, plus custom error messages. The validation documentation describes those tools. They still need to be connected to the import's real business requirements.
I would want a rejection report to identify the source record, the affected field and the reason. “Unknown warehouse code” is more useful than “invalid row”. The reference should remain understandable when a quoted CSV record spans more than one physical line.
I would distinguish malformed data from a valid value the application does not recognise. A new supplier category might require a mapping decision rather than changing every row to an old category.
The report should make it possible to correct and reprocess rejected records through an agreed process, without hiding which records already succeeded.
Decide what happens when only part of a file succeeds
I would ask whether this workflow should accept valid records and reject the rest, or reject the whole batch. Neither policy fits every business task. The application should state which one it uses.
Laravel's database transaction support can commit a group of writes together or roll them back when an exception occurs within the transaction. I would review the actual transaction boundaries and any exception handling in the importer.
A database rollback does not automatically undo emails, external API calls or other work outside that transaction. If importing a record triggers another system, that side effect needs its own completion and recovery design.
The completion report should reconcile records read with records created, updated, rejected or intentionally skipped. “Finished” is not enough information to decide whether the business task is complete.
Check repeat uploads before using retry as a fix
Before rerunning a failed file, I would establish which records reached the database and what another run will do to them. Will it update existing values, skip matches or create duplicates?
The matching rule needs to fit the business. Repeated product references might be errors in a catalogue import but legitimate lines in another workflow. I would avoid a blanket “remove duplicates” step without understanding what each record represents.
I would test a repeat upload with controlled data and check the final records and side effects. That includes a corrected file containing records that were already accepted, not just an identical retry.
Verify the repair and leave a usable import process
I would build a small set of test files around the observed failure and the intended rules. The checks should include:
- A valid file with the expected headers and formats.
- Missing or reordered columns.
- Quoted commas, quotes and line breaks.
- Identifiers with leading zeros.
- Invalid references and deliberately blank values.
- A partial failure followed by an agreed recovery run.
- A repeated upload, with the expected final records.
The result should include a documented template or mapping, a useful preview, clear rejection information and a completion summary. If large files require background processing, progress and failures should be visible there too.
Those details reduce guesswork for the next person using the importer. The useful measure is whether the resulting records match the agreed business rules.
What to send when you need Laravel import help
Start with where the file comes from, what it should create or update, the reported error and whether anything was imported before failure. A small anonymised example can help once we agree a suitable way to share it. Keep customer details, credentials and full production exports out of the initial enquiry.
I am Adam Dawson. My Laravel development and ongoing support includes inherited applications, integrations and reliability work. I can investigate an existing importer and agree a scope for repairing the workflow and checking its results.
Get a clear plan for your CSV import
Tell me what the file should change and what is going wrong. I can trace the failure and scope the work needed for a predictable import process.
Talk to Adam about your Laravel import
Explore Laravel support
Need a hand with this?
Work directly with me on an existing Laravel application, from a focused assessment to ongoing development.
Find the right support
A related project
Improving an existing Laravel application in placeFocused work on catalogue loading and operational screens, backed by regression checks for the workflows already in use.
Related Articles
Signs Your Laravel App Needs a Dedicated Developer Not a One-Off Contractor
If your Laravel application is central to how your business runs but nobody truly owns it, here are the signs you need dedicated ongoing support rather than another one-off contractor.
Taking over a Laravel app with no handover
An inherited Laravel app still has to run tomorrow. Map the live systems, trace one real workflow and make a change you can verify and roll back.
Multi-Location Inventory in Laravel -- What to Decide Before You Build
Multi-location inventory sounds straightforward until you start building it. Here are the decisions that will shape your entire data model before you write a line of code.