To validate customer data imports from a spreadsheet, check the file structure first, then test each row against typed rules for required fields, formats, duplicates and references. Return a row-level error report that names the row, column, problem and fix, and import only the rows the user confirms.
Key takeaways
- Validation works in layers, starting with the file structure and ending with cross-row and database checks.
- Every error message should name the source row, the column, the failed rule and a concrete fix.
- A dry run that uses the same logic as the final commit lets users see problems before any data is written.
- Duplicate customers should be flagged for a person to review rather than merged automatically.
- Keeping the original file and a record of each rejected row makes every import traceable.
What does validation check before a row is saved?
Validation checks the file in layers, from the cheapest test to the most expensive. A sound import first confirms the file can be read, then checks the header, then tests each row against field rules, and finally checks relationships between rows and against existing records.
File-level checks come first. Confirm the encoding, the delimiter and that the header row matches the column mapping you configured. A renamed column should fail here, before any row is read, because a shifted mapping can load wrong values without any visible error.
Field-level rules
Each column needs a type and constraints: required or optional, maximum length, allowed values for status fields, an accepted date format, and a pattern for values such as postal codes or VAT numbers. Keep one written rule per field so the import code and the forms users see later agree.
Relationship checks
Some errors only appear across rows. Two rows with the same email address are possible duplicates, and a row that references a country code or account owner that does not exist in the target system is an orphan. Duplicate detection needs an explicit key, and you should decide in advance whether a match means update or reject.
Which rules should run first?
Run structural and format rules first, because they are cheap and their failures make later checks meaningless. Run duplicate and reference checks last, because they need the complete set of rows and the existing records.
Normalise before you validate
Trim whitespace, unify line endings and convert decimal separators before any rule runs. Otherwise a value with a stray space or a comma used as a decimal point fails a number rule for reasons the user cannot see. Report normalisation too, so the user knows the stored value differs from the file.
Decide what counts as a warning
Not every irregularity should block the import. A missing optional phone number can be a warning, while a missing email address on a row where email is the login must be a blocking error. Writing this distinction down before building prevents disputes once real data arrives.
How should an error report be structured?
An error report is useful when each problem is tied to one row, one column, one rule and one suggested fix. Anything less forces the user back into the spreadsheet to hunt for the problem alone.
- The original row number from the source file, so the user can find it with a filter.
- The column name as the user wrote it in the header, not an internal field name.
- The failed rule in plain language, such as 'Date must use DD/MM/YYYY'.
- The rejected value shown in full, so spaces and hidden characters are visible.
- A severity: a blocking error, or a warning that the row imports with a default value.
Should one invalid row block the whole import?
Usually not, but it depends on whether the rows depend on each other. A partial import that loads valid rows and returns the rest suits independent records such as contacts. It fails when the rows that were rejected are needed by other rows loaded in the same batch.
A common approach is a two-stage run: a dry run that validates everything and writes nothing, followed by a commit that loads only the rows that passed. The dry run and the commit must share one validation function, otherwise the report the user approved will not match what is saved. Integration work of this kind is covered in our system integration services.
Where do customer imports usually fail?
They usually fail at boundaries: encodings, date formats and identifiers that look like numbers. Spreadsheet software can silently drop the leading zeros of a postal code or reinterpret a date-like string, so the import receives values that are already wrong before validation starts.
Validation also has limits. It can confirm that a value is well formed, but it cannot confirm that a customer is real, that a record is current, or that the data may be used for the purpose you intend. Those questions belong to the business and, where personal data is involved, to a qualified legal adviser. For a wider view of how imports fit into connected systems, read our guide on maximising business efficiency through ERP and CRM integration.
Hypothetical examples of a failed and a clean import
Here are two hypothetical scenarios:
In the first, a sales team exports contacts from an old spreadsheet in which the country column is written in several different ways. Without normalisation the import rejects many rows; with a mapping table of accepted spellings, the same file loads and the report lists only the values that could not be matched.
In the second, an operations team uploads a file where the same company appears on several rows with slightly different names. A duplicate rule keyed on the VAT field flags those matches for review instead of creating new records, and a team member decides group by group whether to merge them.
How should users fix errors and re-upload?
Users should fix errors in the file they already have and upload it again, rather than typing corrections into the new system. This keeps one source of truth and lets the same validation run again on the corrected data.
Keep an audit trail for each attempt. Store the original file, the file version that was uploaded, the report produced, and the user who confirmed the commit. When a record looks wrong months later, this trail shows exactly which file and which rule introduced it.
What should a pre-launch import checklist include?
A checklist turns the design above into something a team can test. Work through it with a file that contains deliberate errors, not only clean data.
- Test a file with a wrong header, a wrong delimiter and an unexpected encoding.
- Confirm every rule has a plain-language message and a row reference.
- Run a dry run and compare its result with the commit.
- Check that the original file is stored so each rejected row can be traced.
- Confirm that duplicate keys and reference lookups use the target system's real data.
If your team needs help designing this pipeline, you can review our ERP and CRM integration services or see delivered projects at our published case studies.
Frequently Asked Questions
What is the difference between validation and an error report?
Validation is the set of checks that decides whether each row can be saved, while the error report records what failed and why. Validation runs in the background, but the report is what the user reads and acts on, so it must name the row, column, rule and fix for every problem found.
Should I validate the file before the user uploads it?
Yes, where possible, run basic checks in the browser before upload, such as file type, encoding and header match. This gives fast feedback, but the server must still run full validation, because browser checks can be bypassed and cannot test duplicates or references in the database.
How do I handle dates and numbers from spreadsheets?
Define one accepted format for each field and reject anything else with a message that shows the expected pattern. Spreadsheet programs convert values on open, so ask users to export with text formatting where possible and keep the original text in the audit trail for comparison.
Should duplicate customers be merged automatically?
No, automatic merging is risky because two records can share a name or domain yet belong to different customers. Flag likely duplicates in the report, let a person decide per group, and apply automatic updates only for an exact match on a key the business has agreed.
Who should own the validation rules?
The business owner of each data field should own its rules, with technical staff implementing them. Rui Codex provides technical implementation support for import pipelines, but decisions about what counts as valid customer data remain with your organisation and, where personal data is involved, its legal advisers.
Conclusion
A reliable customer import rests on three habits: validate in layers, report each error with enough detail to fix it, and keep a traceable record of every attempt. Agree the blocking rules with the people who own the data, and test the pipeline with deliberately broken files before the first real upload. Rui Codex is led by a founder with 200+ projects delivered, and its technical team can help you design the import flow for your systems. Request a project consultation at https://ruicodex.com/Contact or email info@ruicodex.com to discuss your project.