0

When I open a Shared Workbook with Multiple Edit enabled, I loose the settings while saving the file using xlwt. Here is the code which I am trying, but this do not save the shared workbook properties/settings while saving back as xls. Is there any simple way I can do this?

def writePowerOnTimeExcel(nrow):
    from xlrd import open_workbook
    from xlwt import easyxf
    from xlutils.copy import copy
    rb = open_workbook('.\\LabInventory.xls',formatting_info=True)
    rs = rb.sheet_by_index(0)
    wb = copy(rb)
    ws = wb.get_sheet(0)
    text=str('here i am in')
    ws.write(nrow+1,3,label=text)
    wb.save(".\\LabInventory.xls")
writePowerOnTimeExcel(i)
Shuvan
  • 5
  • 2

1 Answers1

1

It is not possible. xlrd does not read those property settings. xlwt does not write them.

John Machin
  • 81,303
  • 11
  • 141
  • 189
  • Thanks for your answer. I am still in believe that these libraries are user friendly & most powerful in automating excel. However, as this feature is lacking in the existing xlrd/xlwt libraries, its badly impacting us automating excel operations. In our work environment we heavily use shared work book property in excel for concurrent users. Is there any updated version of any library/module you are aware of which will preserve existing shared workbook properties? Will it work if we use COM library? Kindly share if you have any code snippet/solution handy. Appreciate your help! – Shuvan Dec 30 '11 at 06:32
  • I've never used "shared workbook properties" myself, and nobody (other than you) has asked about it in the 5 years I've been maintaining xlwt. You'll need to experiment yourself to find out if it works with a COM library. I'm sorry that I can't help you more. – John Machin Dec 30 '11 at 20:26