Extract from CSV not firing

Hi guys, I’m new to n8n and I’ve used ChatGPT to create the following synopsis to ease diagnosis.


Describe the problem/error/question

Symptom: The Read CSV node reports Success but emits 0 items, so the next node never runs.

Upstream proof it’s a real file: The previous node outputs 8 items, each with binary data (filename input.csv, mime text/csv, sizes ~12–15.4 MB).

Flow (trimmed):
CKAN Meta → IF CKAN OK → CSV list → Download CSV (file) → Stamp CSV metadata (Function) → Read CSV → Filter PSV rows → …


What is the error message (if any)?

No error. Read CSV shows “Success (0 items)”.


Please share your workflow

Node settings (as in my export / editor):

  • Download CSV (HTTP Request)

    • responseFormat: file

    • options.ignoreResponseCode: true (kept from original build)

  • Stamp CSV metadata (Function)

    • Stamps fileName (ends with .csv) and mimeType = text/csv, then forwards items.
  • Read CSV (node label “Read CSV”; Operation Extract From CSV)

    • Input Binary Field: data

    • Delimiter: ,

    • Encoding: UTF-8

    • Header Row: on

    • Include Empty Cells: on

  • Filter PSV rows (Function) follows Read CSV.


Share the output returned by the last node

  • When it fails (always): Read CSVSuccess (0 items), so downstream nodes don’t run.

  • Upstream (always): 8 binary items present; each shows File Name: input.csv, Mime Type: text/csv, size 12–15.4 MB.


What I’ve tried so far

  1. Pinned Read CSV settings explicitly (binary field data, delimiter ,, UTF-8, header on).

  2. Manually opened the source files outside n8n (CSV with consistent headers).

  3. Checked upstream output in n8n (binary present for all 8 items).


Hypotheses now (and what I plan to try; looking for best-practice advice)

  • Compression/encoding mismatch despite .csv + text/csv:

    • If the server returns gzip (magic bytes 1F 8B) or zip (PK) while named .csv, Read CSV would parse nothing and silently return 0.

    • If the file is UTF-16 LE (common in some exports) but I set UTF-8, parsing can fail.

Concrete checks I’m about to run:

  1. Binary → Text probe

    • Add Move Binary Data (Binary to Text; binary=data; encoding utf8) and inspect first 2 KB.

    • If it’s gibberish or starts with PK / \x1F\x8B, it’s compressed; if readable but shows odd nulls, try utf16le.

  2. If compressed: insert Compression → Decompress (gzip/zip) on data, then feed the result into Read CSV.

  3. If UTF-16: set Read CSV → Encoding = utf16le, or convert to UTF-8 with Binary→Text (utf16le) then Text→Binary (utf8) before Read CSV.

  4. Alternative reader: swap Read CSV → Spreadsheet File (Operation: Read from file, File format: CSV, Binary property: data). In my experience this is more tolerant of BOM/CRLF.


Extra hardening I’ll add either way

  • In Download CSV, turn off ignoreResponseCode (or gate with an IF on statusCode <= 399; else throw).

  • In Stamp CSV metadata, drop items without binary.data so the parser never gets empties:

    const out = [];
    for (const i of items) {
      const b = i.binary?.data;
      if (!b) continue; // only forward real files
      const fromUrl = (i.json.url || '').split('/').pop() || 'input.csv';
      b.fileName = /\.csv$/i.test(fromUrl) ? fromUrl : `${fromUrl}.csv`;
      b.mimeType = 'text/csv';
      out.push(i);
    }
    return out;
    
    
  • Add a tiny guard after the CSV reader:

    if (items.length === 0) throw new Error('CSV parsed 0 rows');
    return items;
    
    

Information on your n8n setup

  • n8n version: n8n Cloud – Latest Beta (I’ve tried latest stable)

  • Database: Cloud-managed (default)

  • EXECUTIONS_PROCESS: default (own, main)

  • Running via: n8n Cloud

  • OS: n/a (Cloud)


Questions for the community

  1. Is it expected that Read CSV returns Success (0 items) on compressed/UTF-16 input without error?

  2. On Cloud, is Spreadsheet File → Read from file (CSV) preferred for robustness?

  3. Any cleaner built-in way to auto-detect compression/encoding on file inputs before parsing?

If a minimal repro would help, I can post one.

Workflow section:

{
“nodes”: [
{
“parameters”: {
“url”: “https://ckan.publishing.service.gov.uk/api/3/action/package_show?id=traffic-commissioners-goods-and-public-service-vehicle-operator-licence-records”,
“jsonParameters”: true,
“options”: { “ignoreResponseCode”: true }
},
“id”: “6ab86082-dc06-442b-9c46-8878dc17df0e”,
“name”: “CKAN Meta”,
“type”: “n8n-nodes-base.httpRequest”,
“typeVersion”: 1,
“position”: [-224, 224]
},
{
“parameters”: {
“conditions”: {
“number”: [{ “value1”: “={{$json.statusCode}}”, “operation”: “smallerEqual”, “value2”: 399 }]
}
},
“id”: “5118ae30-9574-4794-b6d1-d98a4b79f5ed”,
“name”: “IF CKAN OK”,
“type”: “n8n-nodes-base.if”,
“typeVersion”: 1,
“position”: [-48, 224]
},
{
“parameters”: {
“functionCode”: “const res=items[0].json.result||{};const list=(res.resources||).filter(r=>/\.csv$/i.test(r.url||‘’));if(!list.length) throw new Error(‘No plain .csv resources found.’);return list.map(r=>({json:{url:r.url}}));”
},
“id”: “eceef7e2-d04a-45b7-b32c-37cb7f030231”,
“name”: “CSV list”,
“type”: “n8n-nodes-base.function”,
“typeVersion”: 1,
“position”: [144, 224]
},
{
“parameters”: {
“url”: “={{$json[“url”]}}”,
“responseFormat”: “file”,
“jsonParameters”: true,
“options”: { “fullResponse”: true, “ignoreResponseCode”: false }
},
“id”: “6d1a3027-b363-462d-bf1b-1081178776c5”,
“name”: “Download CSV”,
“type”: “n8n-nodes-base.httpRequest”,
“typeVersion”: 1,
“position”: [448, 224]
},
{
“parameters”: {
“functionCode”: “const out = ;\nfor (const i of items) {\n const b = i.binary?.data;\n if (!b) continue; // drop non-files\n const fromUrl = (i.json.url || ‘’).split(‘/’).pop() || ‘input.csv’;\n b.fileName = /\.csv$/i.test(fromUrl) ? fromUrl : ${fromUrl}.csv;\n b.mimeType = ‘text/csv’;\n out.push(i);\n}\nreturn out;\n”
},
“id”: “68de533d-78f8-48e3-abd8-2e76712e7ca1”,
“name”: “Stamp CSV metadata”,
“type”: “n8n-nodes-base.function”,
“typeVersion”: 1,
“position”: [640, 224]
},
{
“parameters”: {
“binaryPropertyName”: “data”,
“options”: {
“delimiter”: “,”,
“encoding”: “utf-8”,
“headerRow”: true,
“includeEmptyCells”: true
}
},
“id”: “e7b8c564-f4bb-4073-9f3a-9e5f1edc003e”,
“name”: “Read CSV”,
“type”: “n8n-nodes-base.extractFromFile”,
“typeVersion”: 1,
“position”: [864, 224]
}
],
“connections”: {
“CKAN Meta”: { “main”: [[{ “node”: “IF CKAN OK”, “type”: “main”, “index”: 0 }]] },
“IF CKAN OK”: { “main”: [[{ “node”: “CSV list”, “type”: “main”, “index”: 0 }]] },
“CSV list”: { “main”: [[{ “node”: “Download CSV”, “type”: “main”, “index”: 0 }]] },
“Download CSV”: { “main”: [[{ “node”: “Stamp CSV metadata”, “type”: “main”, “index”: 0 }]] },
“Stamp CSV metadata”: { “main”: [[{ “node”: “Read CSV”, “type”: “main”, “index”: 0 }]] },
“Read CSV”: { “main”: [] }
}
}

I ran this on my self-hosted and the last node ran for a while, and spat out 181763 rows. Is this really what you are trying to do? Why do you need a list of almost 200000 rows containing almost 80MB of text?

Thank you for getting back to me. The next stage is to filter the rows by postcodes that I have geocoded in a previous step - do you know of a more efficient way to do this?

Begin with I would probably look over files, instead of trying to accumulate all of them at once and process them one by one with Loop Over Items, which will make it look something like that:

but honestly, I am not sure Cloud will like that either, given the limited resources you get on the cloud instance.

If this continues to be a problem, you may want to think of other solutions, like not processing the files in n8n natively, but first loading the data into the database, and let database handle sorting and processing. Think of n8n as orchestration platform, more than data processing, it is not meant to be heavy CPU/MEM loaded.

Thanks so much for your help, I really appreciate it. I tried the ‘Loop Over Items’ approach and, as you guessed, it still didn’t work. When you mention first loading the data into the database, do you mean loading it into n8n or avoiding n8n altogether? If it’s possible to do within n8n, how would you see that being structured?

On a related note, you mentioned running this in a self-hosted environment. Would you recommend I give that a go? I’m not sure what kind of resources it would need, but I do have an M1 Mac Studio if that could handle it.

Hey @georgewhite756

That depends on what is it you want to do after loading the data, and most importantly how often do you need to load the data. If you need to load it just once to the database and then run queries against that data which return small subsets of the data - I would have a separate DB and then use n8n for queries. If you need to populate the database each time - then this is a whole other story. To populate the database from URL I would probably use self-hosted clickhouse. It allows loading CSV data directly from url.

Mac1 can totally handle it! I absolutely do recommend you try it, if you come across issues, you can always come back to the forum and ask.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.