1

I was wondering if someone could help me out with this. I want to make changes to an existing .xls file using xlwt/xlrd/xlutils. I took a look at this question and tried the two answers at the bottom of the page. When I tried the second answer, I got this error:

AttributeError: 'Sheet' object has no attribute 'cooked_page_break_preview_mag_factor'

When I tried the third answer, I got this error:

AttributeError: 'str' object has no attribute 'datemode'

The files I'm using are exactly the same as the ones in the answers with the exception of the filenames.

I appreciate any help. I would have commented on the answers but I don't have enough rep.

Community
  • 1
  • 1
Dave
  • 503
  • 1
  • 8
  • 21
  • Im pretty sure you would need to read it in and output a whole new xls – Joran Beasley Jan 28 '13 at 03:17
  • 1
    Technically, Joran is right; there's no such thing (not even in Excel) of "writing to an existing workbook". What Excel does is blow away the old file and write a brand new one with the same name. That said, `xlutils` should help you do what you need. The error messages you're getting suggest to me that maybe you don't have the latest versions of all the packages. Also, you should post full tracebacks, rather than just a single error message, as it will help others diagnose your problem. – John Y Feb 13 '13 at 22:48

1 Answers1

1

I had the same error and realised that I was copying the sheet instead of the workbook.

rb = open_workbook(file_path,formatting_info=True)
wb = copy(rb)
mateuszb
  • 1,072
  • 13
  • 26