Extract From File
A common pattern in n8n workflows is to receive a file, either from an HTTP Request node (for files you are fetching from a website), a Webhook Node (for files which are sent to your workflow from elsewhere), or from a local source. Data obtained in this way is often in a binary format, for example a spreadsheet or PDF.
The Extract From File node extracts data from a binary format file and converts it to JSON, which can then be easily manipulated by the rest of your workflow. For converting JSON back into a binary file type, please see the Convert to File node.
Operations
Use the Operations drop-down to select the format of the source file to extract data from.
Extract From CSV: The "Comma Separated Values" file type is commonly used for tabulated data.
Extract From HTML: Extract fields from standard web page HTML format files.
Extract From JSON: Extract JSON data from a binary file.
Extract From ICS: Extract fields from iCalendar format files.
Extract From ODS: Extract fields from ODS spreadsheet files.
Extract From PDF: Extract fields from Portable Document Format files.
Extract From RTF: Extract fields from Rich Text Format files.
Extract From Text File: Extract fields from a standard text file format.
Extract From XLS: Extract fields from a Microsoft Excel file (older format).
Extract From XLSX: Extract fields from a Microsoft Excel file.
Move File to Base64 String: Converts binary data to a text-friendly base64 format.
Example workflow
In this example, a Webhook node is used to trigger the workflow. When a CSV file is sent to the webhook address, the file data is output and received by the Extract From File node.
Set to operate as 'Extract from CSV', the node then outputs the data as a series of JSON 'row' objects:
Node parameters
Input Binary Field
Enter the name of the field from the node input data that contains the binary file. The default is 'data'.
Destination Output Field
Enter the name of the field in the node output that will contain the extracted data.
This parameter is only available for these operations:
Extract From JSON
Extract From ICS
Extract From Text File
Move File to Base64 String
Templates and examples
Browse Extract From File integration templates or search all templates
Troubleshoot CSV import issues
The CSV parser is strict. It reads the first row to learn how many columns the file has, then requires every following row to have exactly that many fields. Two of the most common failures are silent, so check the output rather than the workflow status.
"Invalid Record Length: expect 7, got 8 on line 12"
The line in the message has more (or fewer) fields than the first row. In practice the extra field is almost always a delimiter inside a text value that wasn't quoted: an unquoted Acme, Inc. in a company column splits into two fields. The rows around it still parse, so the error names the first row that happened to contain one.
Fix it in the export by quoting any field that can contain the delimiter, doubling any quote mark inside the value:
A value containing a line break needs the same treatment. If the source system can't quote properly, clean the file before the node runs. Normalizing rows in a Code node is more reliable than loosening the parse: a row that silently shifts by one column writes the wrong value into the wrong field.
Rows come out as a single column, with no error
This is a delimiter mismatch: a semicolon- or tab-separated export parsed as comma-separated. Nothing fails. Each line becomes one field, so the output has a single key and the next node's expressions stop matching. Open the file in a text editor and confirm which character actually separates the values before changing anything in the workflow.
Rows merge together, or the data stops partway through
An unbalanced quote mark: an odd number of " characters makes the parser treat everything after it as one long quoted value. As a result, several rows arrive as one item and the following rows look missing. The file usually got there through a manual edit or a hand-rolled export. Scan for a quote mark that has no matching closing quote. Check across line breaks too, because a field that legitimately spans several lines opens its quote on one line and closes it on another.
Last updated
Was this helpful?