the following shows the contents of "datebook.x ls"
Date
8/9/2006
8/9/2006
8/9/2006
8/9/2006
8/9/2006
# read_date.py
import xlrd
book = xlrd.open_workb ook("datebook.x ls")
sh = book.sheet_by_i ndex(0)
ex_qdate=sh.cel l_value(rowx=1, colx=0)
pyd=datetime.da te(1900,1,1)+da tetime.timedelt a(days=sh.cell_ value(rowx=1,co lx=0))
print pyd
for c in range(sh.ncols) :
for r in range(sh.nrows) :
print sh.cell_value(r owx=r,colx=c)
datetime.date(1 900,1,1)+dateti me.timedelta(da ys=sh.cell_valu e(rowx=r,colx=c ))
---- Output ----
2006-08-11>>>
Date
Traceback (most recent call last):
File "D:/Python23/Testing area/Python and Excel/read_date.py", line
12, in ?
datetime.date(1 900,1,1)+dateti me.timedelta(da ys=sh.cell_valu e(rowx=r,colx=c ))
TypeError: unsupported type for timedelta days component: unicode
The first print statement gives me desired output. Whats wrong with>>>
second print statement?
When I give the discriptor or index explicitly its giving the correct
answer.
Why not in the loop?
Am I wrong some where?
Please help me.
Thank you,
Sudhir.