You can use TextFieldParser.HasFieldsEnclosedInQuotes = true;
I tested with your sample and I get the 3 fields
9999
The shopping list includes men's shoes, jackets and helmets
325
Parsing a comma delimited file that has comma embedded within double quotes
Hello:
I am working with a Integration Project in MS VS 2019.
I have a comma-delimited flat file. One of the fields is double-quoted and may have a comma inside it. When the file gets parsed, it gets thrown of by the embedded comma,
For example, one of the lines in the flat file is:
ID, ShoppingList, Amount
9999,"The shopping list includes men's shoes, jackets and helmets", 325
The flat file extracts:
ID: 9999
ShoppingList: "The Shopping list includes men's shoes
Amount: jackets and Helments"
I would like to see the values below:
ID: 9999
ShoppingList: The shopping list includes men's shoes, jackets and helmets
Amount: 325
Please note the double-quotes has been stripped off Shopping list. This is a lesser issue; I can create a calculated field that strips the double-quotes off the value parsed.
But the bigger issyes is that the embedded commas are messing up the parsing.
Thank You.
Venki
-
Castorix31 86,406 Reputation points
2020-11-25T18:01:51.31+00:00
1 additional answer
Sort by: Most helpful
-
Venkat Venkataramanan 76 Reputation points
2020-11-25T18:32:50.733+00:00 Castorix31:
Yes I learned new. The answer was as simple as setting the Text Qualifier to be a double-quotes. It works like a charm.
venki