n8n CSV import: an exercise in validation and reconciliation
Practise an n8n CSV import with leading-zero identifiers, explicit rejection categories and count checks before loading a disposable Data Table.

Checked against the cited sources on .
Your n8n CSV import task and prerequisites

This editorial exercise asks you to design an n8n CSV import that keeps identifiers intact, accounts for rejected records and verifies stored results. The proposed workflow and completion criteria have not been executed or validated. Your task is complete when every input record has one classification and the stored records match the accepted records.
Prepare an n8n workspace, a CSV-capable HTTP sender and an empty, disposable Data Table. Create String columns named customer_id, name and email. n8n documents typed Data Table columns, including String. Data Tables are project-scoped storage for light to moderate use; these sources establish no universal minimum version or plan entitlement for this complete exercise.
Use synthetic records only. We think a disposable destination makes this practice more useful: it lets learners focus on explaining every record before deciding how a shared import should behave.
Sources: n8n-docs/docs/integrations/builtin/core-nodes/n8n-nodes-base.datatable/tables.md at main · n8n-io/n8n-docs · GitHub, n8n-docs/docs/get-started/key-concept-glossary.md at main · n8n-io/n8n-docs · GitHub
Receive the n8n CSV file and inspect identifiers

Create a CSV with the headers and literal values below, representing each Empty cell as an empty CSV field. This suggested fixture contains five data records; the header is excluded from the count. Treat customer_id as an exact identifier, and require all three fields to contain non-whitespace text. Email-format validation is outside this exercise.
| customer_id | name | |
|---|---|---|
| 00127 | Ada | ada@example.invalid |
| 00420 | Ben | ben@example.invalid |
| 00127 | Ada repeat | repeat@example.invalid |
| 00009 | Empty | missing@example.invalid |
| Empty | Cy | cy@example.invalid |
Configure a Webhook to receive binary input, then connect Extract From File using CSV extraction. Match the Webhook's receiving binary property to the extractor's input field. For the test URL, select Listen for test event before sending your n8n CSV file; production uses a distinct URL and requires publishing.
Inspect the parsed customer_id values immediately against the original CSV. The cited CSV extraction documentation does not establish whether CSV extraction preserves numeric-looking identifiers or which parser setting guarantees it. Stop if 00127 becomes 127. A String destination or later conversion cannot restore lost characters; resolve ingestion before proceeding.
Sources: Extract From File | Nodes | n8n Docs, n8n-docs/docs/integrations/builtin/core-nodes/n8n-nodes-base.webhook/README.md at main · n8n-io/n8n-docs · GitHub, n8n-docs/docs/integrations/builtin/core-nodes/n8n-nodes-base.webhook/common-issues.md at main · n8n-io/n8n-docs · GitHub, n8n-docs/docs/integrations/builtin/core-nodes/n8n-nodes-base.datatable/tables.md at main · n8n-io/n8n-docs · GitHub, n8n-docs/docs/integrations/builtin/core-nodes/n8n-nodes-base.set.md at main · n8n-io/n8n-docs · GitHub
Classify records and reconcile before loading

After the identifier check passes, use Edit Fields for explicit mapping and discard unused fields if appropriate. n8n documents custom JavaScript in the Code node and conditional routing with If. The following suggested algorithm for your n8n CSV import is an editorial design for you to implement and verify.
Keep accepted, invalid and duplicate arrays plus a summary in one Code output item. Preserve original field values and a source-record index, and attach rejection reasons. Follow this order so each record belongs to exactly one category; account for n8n's documented item-linking requirements when input and output item counts differ.
- Initialize empty category arrays and a set of accepted customer_id values.
- Inspect each record in source order; classify missing required values as invalid first.
- For a valid record, classify an already-seen customer_id as duplicate; otherwise accept it and remember its identifier.
- Calculate category counts and return the arrays and summary together, even when accepted is empty.
For the fixture, the expected editorial result is five input records: two accepted, two invalid and one duplicate. Before Insert, use If to evaluate input count = accepted count + invalid count + duplicate count. Route a mismatch to Stop And Error; only the matching branch may proceed toward insertion. Test an additional all-invalid fixture: retain its rejection arrays and summary, and skip insertion when accepted is empty.
Remove Duplicates documents current-input deduplication across selected fields following its n8n 1.64.0 overhaul; earlier versions need their corresponding documentation. It documents removal rather than a rejected-duplicate output. In our view, explicit classification is the better learning choice here because the exercise asks you to explain rejected records.
Sources: n8n-docs/docs/integrations/builtin/core-nodes/n8n-nodes-base.set.md at main · n8n-io/n8n-docs · GitHub, n8n-docs/docs/integrations/builtin/core-nodes/n8n-nodes-base.if.md at main · n8n-io/n8n-docs · GitHub, n8n-docs/docs/reusable-content/.gitbook/includes/integrations/builtin/core-nodes/code-node.md at main · n8n-io/n8n-docs · GitHub, n8n-docs/docs/integrations/builtin/core-nodes/n8n-nodes-base.removeduplicates/README.md at main · n8n-io/n8n-docs · GitHub, n8n-docs/docs/integrations/builtin/core-nodes/n8n-nodes-base.stopanderror.md at main · n8n-io/n8n-docs · GitHub
Complete the n8n Data Table import and reflect

For this n8n Data Table import, CSV records must pass the pre-load gate before you send only accepted records to Insert and map each column manually. Read back the destination with Return All while other writers remain paused; n8n warns that concurrent changes can cause omissions or repeats during paginated reads. Compare the stored count and exact identifier values with the accepted array, then check name and email values.
If your n8n CSV import produces missing rows or a count mismatch, inspect the saved classifications, insertion inputs and readback settings before rerunning. The operations reference notes version-dependent behavior, warns that plain Insert can duplicate records on reruns and describes empty outputs when filtering removes every item. An empty branch alone is insufficient completion evidence.
After loading, use a separate If check to compare the readback count and field values with the accepted records, routing any mismatch to Stop And Error. Failure does not establish rollback of earlier writes. Production locking, transaction guarantees and partial-write recovery are outside this isolated exercise. Finish by recording the following suggested reflection decisions.
Sources: n8n-docs/docs/integrations/builtin/core-nodes/n8n-nodes-base.if.md at main · n8n-io/n8n-docs · GitHub, n8n-docs/docs/integrations/builtin/core-nodes/n8n-nodes-base.datatable/rows.md at main · n8n-io/n8n-docs · GitHub, skills/skills/n8n-data-tables-official/references/OPERATIONS.md at main · n8n-io/skills · GitHub, n8n-docs/docs/integrations/builtin/core-nodes/n8n-nodes-base.stopanderror.md at main · n8n-io/n8n-docs · GitHub


