Open Manthazar opened 2 months ago
@Manthazar Looks like library is already handling this as configuration while reading the header. CsvParser.ReadLine method is checking trimOptions, which is Enum with 3 values - None, Trim and InsideQuotes. The case you mentioned can be handled by assigning trimOptions to the configuration. Maybe that is what you are looking for.
Thanks @vivebhagat , but this feature request is about a better error message, not the capability itself to ignore such kind of behaviour. If your upstream (application) starts to add a space for some reason, CSV helper would not be helpful to flag the reason for the parser error. Once one understood the root cause, of course then one could amend the configuration as you described.
Is your feature request related to a problem? Please describe. Given there is a CSV file with quoted headers similar to:
and colum header matching is set to:
config.PrepareHeaderForMatch = args => args.Header.ToLower(),
When we attempt to load the file we get a Bad Data Exception with no useful infomation in it:
--> note the error is the
` space character before the quoted header starts for
Order Number,
CharCount 20`Describe the solution you'd like
xyz
is unknownDescribe alternatives you've considered