CsvHelper.Excel icon indicating copy to clipboard operation
CsvHelper.Excel copied to clipboard

Fix ExcelParser ignoring the requested Culture (BREAKING CHANGE)

Open TheObliterator opened this issue 2 years ago • 1 comments

Note: This fix may cause breaking behaviours as previously the culture conversion was ignored. ExcelParser defaulted to an InvariantCulture in the constructor but actually defaulted to the user's CurrentCulture during parsing. If a specific culture was specified during construction or in the CsvConfiguration, this was also ignored during parsing.

Cause: XLCellValue.ToString() defaults to the user's current culture unless a specific culture is supplied as an optional parameter. This fix passes the Configuration.CultureInfo to the XLCellValue.ToString() to ensure the requested culture is used.


This change is Reviewable

TheObliterator avatar Sep 17 '23 19:09 TheObliterator

I would love to see this PR accepted. Took me some days to realise this exactly was causing the issue when reading a dutch (with comma as decimal separator) Excel file...

mrhighstone avatar Apr 04 '25 20:04 mrhighstone