On 12 Jul 2022, at 11:24, Stephen Hill wrote:
Hi,
I have read around a little, and have seen that the above error can be
caused by style errors etc. in the file, but none of the monkey patches
seem to work!. I was wondering whether anyone had any workarounds etc. or
ways to change the file so that it can be opened by openpyxl. The file i am
having trouble with is attached.
Hi Steve,
thanks for the e-mail and the file and best of all by writing to the mailing list first.
The exception is coming from the defined names and I think this is due to the combination of chartsheets abdand the weird indexing that Excel uses in the workbook part:
there are 8 worksheets but 20 or child objects in total, so the index 19 probably refers to the last item, which is probably "New Monthly Metals", which itself has been handily given the sheetId 61!
but we use the index to refer to the actual worksheet (or chartsheet)
So the code probably needs updating to take into account the "modules" that we don't load and wouldn't persist with as sheets anyway: I mean, why would you? I assume these are some kind of VBA modules.
The quickest workaround for this would be to ignore the defined names if you can, ie. monkey patch the reader so that these are not processed.
The file also throws up some errors related to the new custom properties which I'll need to investigate, at least openpyxl has got better at telling you which things it doesn't like.
Charlie
--
Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Sengelsweg 34
Düsseldorf
D- 40489
Tel: +49-203-3925-0390
Mobile: +49-178-782-6226