Hi, the following shows the contents of "datebook.xls"
Date 8/9/2006 8/9/2006 8/9/2006 8/9/2006 8/9/2006 # read_date.py import xlrd book = xlrd.open_workbook("datebook.xls") sh = book.sheet_by_index(0) ex_qdate=sh.cell_value(rowx=1,colx=0) pyd=datetime.date(1900,1,1)+datetime.timedelta(days=sh.cell_value(rowx=1,colx=0)) print pyd for c in range(sh.ncols): for r in range(sh.nrows): print sh.cell_value(rowx=r,colx=c) print datetime.date(1900,1,1)+datetime.timedelta(days=sh.cell_value(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 ? print datetime.date(1900,1,1)+datetime.timedelta(days=sh.cell_value(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. -- http://mail.python.org/mailman/listinfo/python-list