Edit existing excel workbooks and sheets with xlrd and xlwt
As I wrote in the edits of the op, to edit existing excel documents you must use the xlutils
module (Thanks Oliver)
Here is the proper way to do it:
#xlrd, xlutils and xlwt modules need to be installed. #Can be done via pip install <module>from xlrd import open_workbookfrom xlutils.copy import copyrb = open_workbook("names.xls")wb = copy(rb)s = wb.get_sheet(0)s.write(0,0,'A1')wb.save('names.xls')
This replaces the contents of the cell located at a1 in the first sheet of "names.xls" with the text "a1", and then saves the document.