Search code examples
.netcsvfilehelpers

FileHelpers Nonstandard Embedded Quotes in CSV


We are using FileHelpers to parse a CSV file. Unfortunately, we've run into an issue with data being read into unexpected columns, since the CSV file does not escape embedded quotes:

1,"SURNAME, FIRSTNAME "NICKNAME"",2

instead of doubling them as is usual:

1,"SURNAME, FIRSTNAME ""NICKNAME""",2

We are not at liberty to change the CSV file, so it is necessary to use the file as-is. Is it possible to do this with with a stock build of FileHelpers? If not, is there another .NET CSV library that supports this format out of the box?


Solution

  • Check out the post here, specifically @Mitch Wheat's answer and the OP's own solution: Parse Delimited CSV in .NET