Attempting to add a locale to the exporting Excel file

Copper Contributor

I am trying to use C# to insert numbers and datetime into Excel with the format of a predefined locale (e.g., "fr-FR"), and my computer is running the Windows operating system with the "en-US" locale.
After exporting, I have data like "120 793" for numbers and "1-janv-22" for datetime. Then, in the Excel software, I try to change the format for these number and datetime fields, but it doesn't work.
My question is whether there is a way to insert the locale into the Excel file during export so that when I open the file, the data will be displayed according to that locale, and when I change the format, the data will also change to the selected format?
Thank you!

1 Reply
When an Excel file is opened, cells with a date format are automatically displayed in the correct language, using the Windows locale settings. Same applies to numbers: the correct decimal and thousands separators are automatically applied when the file is opened.