Overview
This node enables reading from and writing to spreadsheet files in various formats such as CSV, Excel (XLS, XLSX), OpenDocument Spreadsheet (ODS), HTML tables, and Rich Text Format (RTF). It is useful for workflows that need to process tabular data stored in spreadsheets or generate spreadsheet files from JSON data.
Common scenarios include:
- Importing data from uploaded spreadsheet files for further processing.
- Exporting workflow data into a spreadsheet file for reporting or sharing.
- Extracting sheet names from a spreadsheet to dynamically select sheets for processing.
For the Write to File operation specifically, the node converts incoming JSON data into a spreadsheet file of the selected format and outputs it as binary data, which can then be saved or passed on to other nodes.
Properties
| Name | Meaning |
|---|---|
| File Format | The format of the output file. Options: CSV, HTML, ODS, RTF, XLS, XLSX. |
| Binary Property | The name of the binary property where the generated spreadsheet file's binary data will be saved. |
| Options | A collection of additional settings: |
| - Compression | (Only for XLSX and ODS) Whether to apply compression to the output file. |
| - File Name | Custom file name for the binary data. Defaults to spreadsheet.<fileFormat>. |
| - Header Row | Whether to include a header row in the output file. |
| - Sheet Name | (For ODS, XLS, XLSX) The name of the sheet to create in the spreadsheet. Defaults to "Sheet". |
Output
The node outputs an array of items with each item containing:
json: An empty object{}since the main output is binary.binary: Contains one property named as per the configured Binary Property input, holding the binary data of the generated spreadsheet file.pairedItem: References the original input item index (always 0 for write operation).
The binary data represents the complete spreadsheet file in the chosen format, ready for saving or further use.
Dependencies
- Uses the external library
xlsxfor reading and writing spreadsheet files. - Requires access to binary data helpers provided by the n8n environment to read input binary data and prepare output binary data.
- No external API keys or services are required.
Troubleshooting
- Empty or missing binary data input: If the input item does not contain the specified binary property, the node will skip processing that item.
- Unsupported file format: Selecting an unsupported file format may cause errors during file generation.
- File name issues: If no file name is provided, the node defaults to
spreadsheet.<fileFormat>. Providing invalid file names might cause issues downstream. - Compression option: Enabling compression only applies to XLSX and ODS formats; enabling it for others has no effect.
- Error messages: Errors related to file writing typically indicate invalid input data structure or unsupported options. Ensure input JSON is well-formed and matches expected tabular data.