pyExcelerator question - dates map to floats?

skip at skip at
Sat Sep 9 23:55:20 EDT 2006

I'm experimenting with pyExcelerator and am reading an XLS file which
contains dates.  In Excel on my Mac they look like "09/13/06".  After
parsing them out of the .XLS file they are floats, e.g. 38973.0.  I assume
that's an offset in days.  Doing a little date math I come up with a base
date of approximately (though not quite) 1900-01-01:

    >>> import datetime
    >>> dt = datetime.timedelta(days=-38973)
    >>>, 9, 13) + dt, 12, 30)
    >>>, 1, 1) - dt, 9, 15)

Is there some way to get pyExcelerator from doing this conversion and
instead return dates as strings?  If I'm reading an arbitrary worksheet and
don't know which columnn might be a date, it's kind of hard to guess.


More information about the Python-list mailing list