Overview
This node, named 'Text File Parser', is designed to process text files and parse their content based on fixed-length field mappings. It supports operations such as reading a text file, parsing a text file with fixed-length format, and mapping content fields from source fields with specified fixed-length definitions. This is useful in scenarios where text data is structured in fixed-width fields, such as legacy data files, logs, or reports, allowing users to extract and transform specific data fields for further processing or analysis.
Use Case Examples
- Extracting fixed-length fields from a text file containing transaction records to map them into structured JSON objects.
- Reading a binary text file, converting it to UTF-8 string, and parsing its content based on predefined field mappings.
- Parsing a text file with header and footer lines, ignoring these lines, and extracting data lines into structured output.
Properties
| Name | Meaning |
|---|---|
| Source Fields | Defines the source fields and their fixed-length field mappings to parse content fields from input data. |
Output
JSON
fileName- The name of the file from which the content was read or parsed.
- Parsed fields as defined by the field mappings, with values extracted from the source fields.
Dependencies
- No external dependencies beyond n8n core and workflow helpers.
Troubleshooting
- Error 'Binary data is empty' occurs if the input binary field does not contain data; ensure the binary field is correctly specified and contains data.
- Error 'Text content field not found' occurs if the specified text field does not exist in the input JSON; verify the field name and input data structure.
- If no source fields or field mappings are provided, the node throws an error; ensure at least one source field with field mappings is configured.
- Parsing errors may occur if the input text does not conform to the expected fixed-length format; verify the start positions and lengths in field mappings.