Tips > Data, APIs & Webhooks

Use Binary Data Conversion Nodes to Transform Files

n8n has dedicated nodes for reading and writing file formats: Extract From File reads spreadsheets (XLSX, CSV), PDFs, and more into JSON items, while Convert

Use n8n's Extract From File and Convert to File nodes instead of writing custom parsing code. Extract From File reads XLSX, CSV, PDF, and more into JSON items; Convert to File does the reverse. They handle encoding, sheet selection, and header detection automatically, so a read-validate-write pipeline (for example XLSX to JSON to CSV) needs no manual parsing code.

What do the Extract From File and Convert to File nodes do?

n8n has dedicated nodes for reading and writing file formats: Extract From File reads spreadsheets (XLSX, CSV), PDFs, and more into JSON items, while Convert to File does the reverse. Use these instead of writing custom parsing code -- they handle edge cases like encoding, sheet selection, and header detection automatically.

Real-world example: A Google Drive trigger detects a new XLSX file uploaded by a client. You need to read the spreadsheet, validate the data, and generate a PDF report.

How do you build a file transformation pipeline?

Workflow structure:

[Google Drive Trigger] → [Extract From File] → [Code: Validate] → [Convert to File] → [Send Email]
     (new .xlsx)           (XLSX → JSON)         (check rows)       (JSON → CSV)      (attach CSV)

Extract From File node configuration:

Setting Value
Operation Extract From XLSX
Binary Property data
Header Row Enabled
Sheet Name Sheet1
// Input: binary XLSX file with columns: Name, Email, Amount
// Output: JSON items
[
  { "Name": "Alice", "Email": "alice@co.com", "Amount": 1500 },
  { "Name": "Bob", "Email": "bob@co.com", "Amount": 3200 },
  { "Name": "Carol", "Email": "carol@co.com", "Amount": 750 }
]

Validation Code node:

const items = $input.all();
const valid = [];
const invalid = [];

for (const item of items) {
  if (item.json.Email && item.json.Amount > 0) {
    valid.push(item);
  } else {
    invalid.push({
      json: { ...item.json, error: 'Missing email or invalid amount' }
    });
  }
}

// Send valid items downstream, log invalid separately
return valid;

Convert to File node configuration for the output:

Setting Value
Operation Convert to CSV
Binary Property report
File Name validated_data.csv

The Send Email node then attaches the report binary property as validated_data.csv. The entire file transformation pipeline requires zero manual parsing code.

Which node should you use for each data task?

Summary. The most effective n8n data transformation workflows combine the right node type for each task: Edit Fields for renaming, Merge for joining, Split Out and Aggregate for reshaping cardinality, Code nodes only for genuine programming logic, and binary nodes for file format conversion. Defensive fallback expressions and consistent date handling via Luxon round out a robust data transformation toolkit.

Related: Flatten Deeply Nested API Responses · Use the HTTP Request Node as a Universal Connector

Showcase builds

19 complete workflows from my own projects, each with its n8n workflow JSON to import. Showcase entries link the file at the end of the article.

See the showcase builds

Keep reading

190 entries grouped by topic, from first workflow to queue mode. Free, no signup.

Browse the encyclopedia

Need it built?

I design, build and run n8n systems for clients. Every engagement starts with a $1,500 diagnostic audit, credited toward the build.

Book an introductory call