Using scatter charts corrupts the excel files

Issue #886 invalid
M W
created an issue

I am having trouble creating scatter charts in openpyxl. I have tried stripping everything back to be as simple as possible, and just creating a simple chart causes excel to identify the document as corrupt.

I have created a mockup of the script i am using, and it has the same issues - see attached. The script attached creates a simple enough excel file that excel is able to recover it by removing the chart (see excel error recovery log attached, although it isnt very helpful). The use case i am working with creates a document with large data sets on multiple sheets, with a chart on each. Excel is unable to recover these files.

I am using the following: Excel 2010, Python 3.6.1, openpyxl 2.4.7

Comments (15)

  1. M W reporter

    It must be infuriating knowing that there is so many performanc upgrades in 3.6 that you cannot use because of providing support for older versions!

  2. M W reporter

    I have re-written the script using openpyxl as the writer, and it has solved the issue. I believe the issue is in the way pandas implements its save and close methods when it subclasses openpyxl. Using either the pandas writer.save or writer.close results in a corrupt workbook, but accessing the internal openpyxl method using writer.book.save works fine.

    Sorry for the red herring, i will open the issue on the pandas dev page.

  3. CharlieC

    I'm currently developing using 3.5 but I don't think that f strings are that much faster… and I don't really need os.startfile either. f strings are really nice addition to the syntax but not as important as async stuff. Just haven't really seen much opportunity to use that. Maybe with the upcoming async support for lxml I can clean up some fairly hairy code.

    I developed code for working with Pandas with an aim of improving the write_excel() method, which currently relies on openpyxl's internals, but I haven't had time to write a PR.

    Good to know that the problem disappears if you stick with openpyxl.

  4. M W reporter

    yeah I actually meant some of the other features of 3.6, althought it is worth noting that the f-string implementation got updated in 3.6.1 and is now several orders of magnitude faster than all of the other string formatting methods.

    Thanks for your help (and pyopenxl!).

  5. Log in to comment