Convert File to JSON (Enhanced)
AI-generatedOverview
This node converts various file types (DOCX, XML, YML, XLSX, CSV, PDF, TXT, PPTX, HTML, and others) into JSON or text format. It supports enhanced processing for Excel files, preserving row and column information, and can output each sheet as a separate workflow item. It is useful for workflows that require extracting structured data or text from files for further processing or analysis.
Use Case Examples
- Extract data from Excel spreadsheets while preserving original row numbers and sheet names.
- Convert PDF or DOCX files to plain text for text analysis or indexing.
- Parse CSV files into JSON objects for data transformation workflows.
Properties
| Name | Meaning |
|---|---|
| Binary Property | Name of the binary property that contains the file to be converted. |
| Max File Size (MB) | Maximum allowed file size in megabytes to process. |
| Max Concurrency | Maximum number of files processed concurrently. |
| Include Original Row Numbers | For Excel files, include the original row number from the source file in the 'origRow' property. |
| Include File Name | Include the filename in each sheet object. |
| Include Sheet Name | Include the sheet name in each sheet object. |
| Output Sheets as Separate Items | Output each sheet as a separate workflow item instead of grouping by file. Text files are ignored when enabled. |
Output
JSON
files- Array of processed file objects containing extracted JSON or text data.totalFiles- Total number of files processed.processedAt- Timestamp when the processing was completed.
Dependencies
- Uses multiple libraries for file parsing and conversion including exceljs, papaparse, mammoth, pdf-parse, xml2js, chardet, iconv-lite, xlsx (SheetJS), and others.
Troubleshooting
- FileTypeError: Thrown if input item is not an object or lacks binary data or the specified binary property is missing.
- EmptyFileError: Thrown if the file is empty or contains no data/text after processing.
- FileTooLargeError: Thrown if the file size exceeds the configured maximum file size.
- UnsupportedFormatError: Thrown if the file type is not supported or cannot be detected.
- ProcessingError: Thrown if an error occurs during file parsing or conversion, with details about the file type and error message.