Your CSV did not fail to import. One row in it has one field more than the header promises — nearly always a trailing semicolon at the end of the line — and n8n's Extract from File node refuses that row instead of guessing.
If it is one broken export and you would rather not debug it: a person opens the file, repairs it and sends it back with a report naming every dropped row and every value rewritten. $49 up to 5,000 rows, back within 24 hours, 14-day refund if it does not match that sentence.
Fix up to 5,000 rows - $49 Or repair it free in your browserNot ready to pay anything? Mail the broken file and the first look is free — a human reads it and tells you what is wrong before you spend a cent: perun.intelligence@gmail.com.
The free browser repair fixes this exact class of damage without an upload or an account. The fix below is free and complete either way — read it first if you would rather do it yourself in five minutes.
Take the numbers literally. The parser read the first line, decided the file has 7 columns, then reached a row that splits into 8 fields on the delimiter you selected. A CSV row with the wrong field count cannot be mapped onto named keys, so the node stops. The row is not corrupt and the data is not lost.
| What you see | What it means |
|---|---|
columns length is 7, got 8 | One field too many — a trailing delimiter, or an unquoted value containing the delimiter |
columns length is 8, got 7 | One field too few — the exporter omitted the last empty cell, or a value was lost upstream |
got 1 or expect 1, got 2 | The delimiter is wrong: the file is semicolon-separated and the node is set to comma, so the header and most rows hold one field — only the rows whose free text contains a comma are rejected, which is why the line number looks random |
got 13 when the header has 7 | A field contains the delimiter and is not quoted, so one cell has been split into several |
The number after on line is a line number in the file, counting the header as line 1. Open the CSV in a plain text editor (Notepad++, VS Code, less), switch line numbers on and look at that line and the one before it:
...;R; when the header has 7 fields) you have found it. This is the most common cause by a wide margin: spreadsheet exports write an empty cell after the last column and then a separator.Excel is lenient by design. It accepts a trailing delimiter, pads short rows, re-guesses the separator from the first line and silently merges or splits cells when a row disagrees with the header. n8n's Extract from File node is strict: it uses the delimiter you selected and refuses a row whose field count differs from the header. So "the file is fine, I opened it" and "the node fails" are both true. The file contains rows Excel quietly repaired on screen.
Open the free CSV repair and drop the file on it. It removes trailing delimiters, re-pads short rows to the header, normalises quoting, dedupes by email and repairs wrongly decoded letters (question marks, é, UTF-8 read as GB18030), then hands you a download plus a report of every row it changed.
Nothing is uploaded: the file is read with the browser's own file API and repaired in the tab. No fetch, no analytics, no storage — you can confirm it by searching the page source for network calls.
;, and the node defaults to ,. If the error said got 1, this is the whole problem.This behaviour, and the fact that a trailing delimiter is rejected rather than tolerated, was reported to n8n as issue #20524; the maintainers routed it as an enhancement rather than a bug, so do not wait for the node to become lenient.
When you cannot control the export (a supplier, a client, a nightly FTP drop), normalise the rows before they reach the CSV node's output. This runs once for all items and takes one item holding the file as text:
// Code node, mode: Run Once for All Items
// input: one item { csv: "<file contents as text>" }
const DELIM = ';';
const text = $input.first().json.csv.replace(/^\uFEFF/, '');
const lines = text.split(/\r?\n/).filter(l => l.trim() !== '');
// a trailing delimiter on the header line is a phantom column, not a field
const rawHeader = lines.shift().split(DELIM);
while (rawHeader.length > 1 && rawHeader[rawHeader.length - 1].trim() === '') rawHeader.pop();
// duplicate header names would silently overwrite each other in the object
const seen = {};
const header = rawHeader.map((h, i) => {
let name = h.trim() || 'column_' + (i + 1);
if (seen[name]) name = name + '_' + (++seen[name]); else seen[name] = 1;
return name;
});
const rows = lines.map((line, i) => {
const cells = line.split(DELIM);
// a trailing delimiter produces empty overflow cells - drop them
while (cells.length > header.length && cells[cells.length - 1].trim() === '') cells.pop();
// a short row gets the missing cells as empty strings
while (cells.length < header.length) cells.push('');
const out = { __source_line: i + 2 };
header.forEach((h, j) => { out[h] = cells[j] === undefined ? '' : cells[j].trim(); });
return { json: out };
});
return rows;
Tested on a 7-column sample with a trailing delimiter on the header line, one short row (3 of 7 fields), one row with an extra trailing field and a duplicate header name: 5 rows out, 7 keys, no unnamed column, email and email_2 kept apart, and __source_line pointing at the original line so a padded row can be traced back.
Two honest limits, because they decide whether this is enough:
"Smith, John" with a comma separator), splitting on the delimiter breaks it. That needs a real parser — which is what the node already is, and why Fix 1 exists.The message names one line, but the cause is usually the delimiter, not that line. A semicolon-separated export read with the node set to comma gives the header one field. Every row then holds one field too — until a row whose free text contains a comma arrives, and that row splits into two. That is the real shape of Invalid Record Length: expect 1, got 2: the line number looks random because only the rows with a comma in a text column fail.
Four cases, measured on fixtures, so you can match yours:
| File | Result |
|---|---|
| Semicolon file, comma delimiter, one row with a comma in a note | One rejected row: 2 fields against a 1-field header |
| Row ending with the delimiter | One rejected row: one field too many |
| Short row (2 of 3 fields) | One rejected row: one field too few |
| Blank line, including a trailing one at the end of the file | One rejected row — an empty line is a single empty field |
And one failure the error never reports: an unbalanced quote ("he said "hi" ok", from an exporter that stripped the inner quotes) swallows the following rows into one cell. The parser accepts it, the import reports success, and the rows are gone. If your row count is lower than the file's line count, that is what happened.
Paste this over the CSV node while you diagnose: it parses quote-aware and returns only the rows whose field count differs from the header, each with the line it starts on.
// n8n Code node - Run Once for All Items
// Input: one item whose json.data holds the raw CSV text (read the file as text first)
const DELIM = ','; // set to ';' if the file is semicolon-separated
const text = $input.first().json.data;
// quote-aware scan: a quoted field may contain the delimiter and line breaks
const records = [];
let fields = [], field = '', inQuotes = false, line = 1, recordLine = 1, started = false;
for (let i = 0; i < text.length; i++) {
const c = text[i];
if (!started) { recordLine = line; started = true; }
if (inQuotes) {
if (c === '"') {
if (text[i + 1] === '"') { field += '"'; i++; } else inQuotes = false;
} else {
if (c === '\n') line++;
field += c;
}
continue;
}
if (c === '"' && field === '') { inQuotes = true; continue; }
if (c === DELIM) { fields.push(field); field = ''; continue; }
if (c === '\r') continue;
if (c === '\n') {
fields.push(field);
records.push({ line: recordLine, fields });
fields = []; field = ''; line++; started = false;
continue;
}
field += c;
}
if (started || field !== '' || fields.length) { fields.push(field); records.push({ line: recordLine, fields }); }
const header = records.shift();
const want = header ? header.fields.length : 0;
const bad = records.filter(r => r.fields.length !== want);
return bad.slice(0, 50).map(r => ({ json: {
line: r.line,
fields_found: r.fields.length,
header_fields: want,
diff: r.fields.length - want,
first_cells: r.fields.slice(0, 3).join(' | ').slice(0, 120),
} }));
Tested on 11 fixtures — clean file, CRLF endings, trailing delimiter, short row, blank last line, quoted field containing the delimiter, quoted field spanning two lines, semicolon file, semicolon file with a comma in the text, Excel-stripped inner quotes, trailing blank line. The seven that should pass return no rows; the four that should fail name the right line and the right difference. Set DELIM to the delimiter you selected in the CSV node.
The rule of thumb: a rule can fix formatting, only a person can fix a decision. Formatting is a trailing delimiter, a wrong code page, a short row, a duplicate. A decision is which of two header rows is the real one, how to split a column that was merged on export, whether ACME Ltd and Acme Limited are one customer, and which of two conflicting phone numbers is current.
$49 · one export up to 5,000 rows
$79 · up to 25,000 rows — a month of form exports or one CRM migration batch
$99 · up to 100,000 rows — the full house list
You get the cleaned CSV, the row report naming every dropped row and every value rewritten, and a 14-day refund if the result does not match the description. Back within 24 hours. Mail the file first if you would rather have an answer before any payment — the first look is free: perun.intelligence@gmail.com.
Fix up to 5,000 rows - $49 Try the free repair firstPaying opens PayPal and charges dragana.karans@gmail.com; every file, question and refund is handled from perun.intelligence@gmail.com.