Am .11.2015, 23:09 Uhr, schrieb Philipp Freyer <
pif...@gmail.com>:
> Hi all,
> as promised in the previous thread, here the thread for another problem,
> I stumbled upon:
> Scenario:
> I need to update information in a lot of Excel worksheets. They are
> created with Excel 2007.
FWIW as Excel 2007 itself doesn't conform to the specification it's
possible that files that have been processed by openpyxl will *not* be
readable by by Excel 2007.
> Editing the data works fine but I have problems if someone using these
> sheets inserts another worksheet into them by copying them from another
> workbook with Excel by right-clicking on their tab in Excel and selecting
> the "move or copy" option for copying the worksheet.
That is not relevant in this case.
> The script just opens and saves the file, removing the external links
> (reason: see previous thread) and including one comment.
>
> When I open the resulting file afterwards, I get the following error:
>
> *Excel found unreadable content in 'TESTBOOK_broken.xlsm'. Do you want
> to recover the contents of this workbook? If you trust the source of
> this workbook, click Yes.*
>
> When I click "Yes", Excel repairs the file, giving me the following
> error log:
Wow! A log that isn't total shit for once. But, seeing as the file can be
viewed and validated in the Productivity Tool it's also easier to identify
the culprit.
> I will happily provide all the information I can, if you need more
> information. If you classify this as a bug, I will also create an issue
> in Bitbucket.
Yes, please do.
> What I did not notice before: Not only the comments, but also the data
> validation that I set are a problem for Excel. I saw in the
> documentation that it is not possible to read existing data validation,
> but should openpyxl at least be able to keep it? If not, is there a way
> to remove existing validation, so that I can just replace it?
Actually, that's no longer the case: we do preserve data validations but
it looks like I, er, added a feature in 2.3 in converting to
Serialisable-based code so the the containing XML tag is wrong.
Charlie
--
Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Kronenstr. 27a
Düsseldorf
D- 40217
Tel:
+49-211-600-3657
Mobile:
+49-178-782-6226