On Jan 9, 10:24 am, pp <parul.pande...@gmail.com> wrote: > Whenever i run the code below I get the following error: > > AttributeError: 'Book' object has no attribute 'on_demand' > WARNING: Failure executing file: <copy.py> > > Why is it so?? > > from xlrd import open_workbook > from xlwt import easyxf > from xlutils.copy import copy > rb = open_workbook('source.xls',formatting_info=True) > rs = rb.sheet_by_index(0) > wb = copy(rb) > ws = wb.get_sheet(0) > plain = easyxf('') > for i,cell in enumerate(rs.col(2)): > if not i: > continue > ws.write(i,2,cell.value,plain) > for i,cell in enumerate(rs.col(4)): > if not i: > continue > ws.write(i,4,cell.value-1000) > wb.save('output.xls')
I suspect your version of xlrd is not up to date (although I thought on_demand was ages ago!). Make sure all the tools are the latest versions from http://www.python-excel.org There's also a dedicated Google Group for the xl* products listed on that page. hth Jon. -- http://mail.python.org/mailman/listinfo/python-list