How do I read Excel file in Python?

Simon Brunning simon at brunningonline.net
Thu Oct 5 15:03:56 EDT 2006


On 5 Oct 2006 10:25:37 -0700, Matimus <mccredie at gmail.com> wrote:
> > the date( 8/9/2006 ) in Excel file, i am getting the value as 38938.0,
> > which I get when I convert date values to general format in Excel. I
> > want the actual date value. How do get that?
>
> 38938 appears to be the date in days since 1/1/1900. I'm sure someone
> can help you figure out how to convert that to a more useful value.

>>> excel_date = 38938.0
>>> python_date = datetime.date(1900, 1, 1) +
datetime.timedelta(days=excel_date)
>>> python_date
datetime.date(2006, 8, 11)

-- 
Cheers,
Simon B
simon at brunningonline.net
http://www.brunningonline.net/simon/blog/



More information about the Python-list mailing list