Skip to content
Advertisement

Converting a .xlsx date into a normal date

I’ve been using xlrd3 to manage a .xlsx spreadsheet through python. When I’m given the value of the cell the date should be in, it gives me 44295, which should be 09/04/2021.

I understand that this is because of the format excel stores dates as, so I’ve been using the xldate_as_datetime function in this way:

JavaScript

(i is an interable from a ‘for’ loop)

When the code is (lastsold,0) I get the error

JavaScript

And when the code is (lastsold,1) I get the error.

JavaScript

What can I do so I can get the date in the format 09/04/2021 in python?

Advertisement

Answer

I have tested with below code and it works well. Please check it.

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement