Home > Net >  Getting the original language or original text of date in Excel file
Getting the original language or original text of date in Excel file

Time:06-21

I have a Django application where I give users a Excel file for them to give me dates, i ask them to give me the date in DD/MM/YYYY format (the one used in Latin America) The problem is that if the language of the Excel file is in English, it uses the MM/DD/YYYY format. So for example if they write 01/05/2022, when i open the file in my application i receive 05/01/2022.

So I want to know if there is a way to get the original language of the excel file, for me to put some conditions inside my application, or if i can get the original raw text of the file.

I can't change the format that the application uses (because I receive excel files that are mainly in the spanish language) or ask my clients to write the dates in a different format, or ask them to change the language of the file.

I am open for other type of solutions too.

CodePudding user response:

An Excel file doesn't have a "language". The system that Excel runs on has settings for region and language.

Excel will store a date as a number internally, so if my system uses US English with MDY format, then May 5 will be stored as 44682 and if my system uses a language with a DMY, then May 5 will still be stored as 44682.

So, if you get the underlying numeric value for the date, you would not need to be concerned what format was used to enter it.

  • Related