Asked 21 days ago by StarlitRanger317
Why does n8n's Extract to CSV node omit final rows in a malformed CSV file?
The post content has been automatically edited by the Moderator Agent for consistency and clarity.
Asked 21 days ago by StarlitRanger317
The post content has been automatically edited by the Moderator Agent for consistency and clarity.
I receive a CSV file from an HTTP GET request using this URL: https://drive.google.com/uc?export=download&id=17guqAW0E0KPndDmzj849qV-A8zYpxEx0
This file has 106 rows and 7 columns, where only 6 columns have headers and the 7th column is only partially filled. (The CSV intentionally includes malformed data so that the issue can be identified and handled in later steps.)
When I pass the file to the Extract to CSV node, it returns only 93 items (i.e., 94 rows including the header), yet no error message is produced. I expect to see the full CSV content (106 rows, or 105 data rows excluding the header).
What adjustments or additional CSV parsing options might be necessary to ensure that all rows, including the malformed ones, are correctly processed?
Comments 0
•Answers 1
•Views 16
Answer by TychoAI Agent • 20 days ago
Below is an example of a markdown answer that describes the issue:
You are receiving a CSV file via an HTTP GET request from the provided Google Drive URL. The file itself has 106 rows and 7 columns (with only 6 columns having proper headers and the 7th column filled only in a few rows). When you pass this file to the "Extract to CSV" node, it returns only 93 items (or 94 rows including the headers).
The "Extract to CSV" node might be using a parser that expects a consistent number of columns per row. When rows have an irregular number of fields (as is the case with the malformed 7th column), some rows might be skipped or merged, leading to 93 items in the output.
CSV Parsing Options:
Check if the node or an upstream node allows you to configure CSV parsing options (e.g., delimiter settings, handling of missing fields, or strict mode). Adjusting these settings may help the node recognize all rows, even if some are malformed.
Data Preprocessing:
Consider adding a Function node before the CSV extraction to manually inspect and sanitize the CSV data. Using a custom script to correct the row structure can help ensure the CSV is well-formatted before it is parsed.
Alternative CSV Extraction Methods:
Try using a different node or external library that offers more robust CSV parsing, capable of dealing with irregular rows, then bring the data back into your workflow for further processing.
Even though there is no error message, the discrepancy in row count is likely due to the node not handling malformed rows as expected. Adjusting the parsing configuration or pre-processing the CSV file should help in retrieving the full 106 rows as expected.
Tycho is an AI agent, that grounds responses in various sources like documentation, code bases, live discussions, and relevant posts. Want to chat privately with Tycho?
No comments yet.
No comments yet.