---
title: Extract From File
description: Turn a file into items, with the format auto-detected
---

Turn a downloaded or picked file (CSV, JSON, XML, text or PDF) into workflow items.

## What it does

Extract From File reads the file attached to the incoming item and returns its contents as a list of items. What you get depends on the format:

* **CSV**: one item per row, keyed by the header row. Empty rows are skipped.
* **JSON**: an array gives one item per element; a single object gives one item; a plain value gives `{ "value": ... }`.
* **XML**: the whole document as one object. Attributes get an `@` prefix and repeated elements become lists.
* **Text**: one item per line, each as `{ "text": "..." }`.
* **PDF**: one item with the extracted `text` and `pageCount`.

The file can come from an [Http Request](/nodes/builtin/core/http-request/) download (stored under `$binary`) or from [Local File Read](/nodes/builtin/datatransformation/localfileread/) (`name`, `type`, `content`). Each incoming item is treated as its own file. Excel files (XLSX) are not supported.

With **Format** on *Auto-detect*, the node looks at the file's type first (for example `text/csv` or `application/pdf`), then the file name's extension (`.csv`, `.json`, `.xml`, `.pdf`, `.txt`), then the first characters of the content (`%PDF`, `{`, `[` or `<`).

## When to use it

* Read rows from a CSV or JSON file that an [Http Request](/nodes/builtin/core/http-request/) downloaded.
* Let someone pick a file with [Local File Read](/nodes/builtin/datatransformation/localfileread/) and process each row or line.
* Get the text out of a PDF without caring about page settings. For per-page text or a custom output field, use [PDF Parser](/nodes/builtin/datatransformation/pdfparser/) instead.
* For CSV with a different delimiter or no header row, use the [CSV](/nodes/builtin/datatransformation/csv/) node instead: this node always splits on commas and treats the first row as headers.

## Inputs and settings

**Binary Field** only matters for files from Http Request, which stores a download under `data` by default. Items without a binary are read from their `content` or `text` field instead.

From Local File Read, set **Read as** to *Text* for CSV, JSON, XML and text files, and to *Data URL* or *Base64* for PDFs.

## Outputs

The output is always a list. CSV, JSON arrays and text files usually give many items, so the next node runs once per row or line. XML, PDF and single-object JSON give one item.

## Dependencies and credentials

None. This node needs no connection and has no slots for other nodes.

## Example workflow

1. An [Http Request](/nodes/builtin/core/http-request/) downloads `https://example.com/prices.csv`.
2. **Extract From File** with **Format** on *Auto-detect* turns it into one item per row.
3. [Filter](/nodes/builtin/flow/filter/) keeps rows where `{{ $input.stock }}` is `0`.
4. [Slack](/nodes/builtin/integration/slack/) posts the out-of-stock products.

## Common issues

* **"Could not detect the file format. Set the Format field manually (CSV, JSON, XML, Text or PDF)."** The file had no useful type, extension or recognisable start. Choose the format in **Format**.
* **"No file to extract. Attach a binary under $binary, or provide a file from Local File Read."** The incoming item has no file under **Binary Field** and no `content` or `text` field. Check the key name, or connect the node that produced the file.
* **"Could not parse JSON: ..."** The file is not valid JSON, or auto-detect guessed JSON wrongly. Fix the file or pick the right **Format**.
* **"Field "data" could not be decoded as base64 PDF data."** A PDF was read as *Text* by Local File Read. Set **Read as** to *Data URL*.
* **A `.tsv` file comes out as one column.** Tab-separated files are detected as CSV but split on commas. Use the [CSV](/nodes/builtin/datatransformation/csv/) node with a tab delimiter.

## Related nodes

* [PDF Parser](/nodes/builtin/datatransformation/pdfparser/): PDF text with per-page options.
* [CSV](/nodes/builtin/datatransformation/csv/): CSV with custom delimiters, or writing CSV.
* [XML](/nodes/builtin/datatransformation/xml/): convert XML text to JSON and back.
* [Local File Read](/nodes/builtin/datatransformation/localfileread/): let the user pick a file.