Search code examples
pythonexceldatexlrd

How to convert from Python date to Excel date using xlrd (attribute xlrd.xldate_from_date_tuple does not exist)


How to convert from Python date to Excel date using xlrd module? How to convert a python datetime.datetime to excel serial date number suggests a 'manual' solution, I wonder if it is the best way.

Xlrd document suggests to use xlrd.xldate_from_date_tuple

but

>>> import xlrd
>>> xlrd.xldate_from_date_tuple
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'xldate_from_date_tuple'

Could you help? Thanks.


Solution

  • Use xlrd.xldate.xldate_from_date_tuple