ERROR CSV ReaderExecute failed: New line in quoted string (or closing quote missing)

I am using a CSV READER node to read a CSV file.

I am getting this error :

ERROR CSV Reader Execute failed: New line in quoted string (or closing quote missing)

I could not figure out the reason for the above error.

What is causing this error?

How do I resolve this?

Thanks,

Kannan

Hi,

Me and a colleague of mine spent a complete day with this error last week. There are several possible reasons. At first KNIME seems unable to support line breaks within data fields, even if they are correctly enclosed by brackets.

If you have a dataset without line breaks your CSV file formatting is not correct. Check if your data fields are enclosed by quotation marks and if quotation marks are correctly masked within each data field. Another possible source of error is if you did not mask your field separator (e.g. comma) within data fields.

Unortunately it is hard to debug these problems. I started by copying my CSV file in thousand line blocks over to a new file and reading that file until the error occurs. Then you remove the last 500 lines from the new file and so on until you find the incorrect line. I guess you got it.

I hope you can find your error.

Regards

Another common source of this problem is if your data legitimately contains one of the default quote characters (' or " in the file readernode, " in the CSV reader node) in a cell, in which case you need to change the settings in the CSV or the file reader advanced settings not to recognise this as a quotation character.

Steve

1 Like

Another option is to switch to an Excel reader though this may introduce another set of issues.

Thank you all. I am going to try each one of your suggestions today. BTW I could not get Excel Reader. Can you send me the link where I can download this from?

Thanks

Kannan

Nothing works like brute force trial and error.  There were some newline characters in my CSV file. I used Excel CLEAN function to remove all these. After this the CSV READER worked good. Thanks for all your advice.

Kannan

1 Like

If you have more complex CSV files, the R package readr might help

https://hub.knime.com/mlauber71/spaces/Public/latest/kn_example_import_csv_r_readr

Alison if you have to deal with complex Excel files other packages from R or Python might help.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.