Yes, please do. Seems to be working at the moment.
I'm not sure if it's related to:
https://bitbucket.org/openpyxl/openpyxl/issue/406/excel-gives-an-error-opening-the-xlsm-file
> Setting:
> - Ubuntu 14.0.4
> - Python 2.7.6
> - openpyxl 2.1.4
> In our code we load a workbook (attached: Titelanalyse_USA3.xlsm):
> wb = load_workbook(filename=file_path, data_only=True, guess_types=True)
I think you probably don't want guess_types=True for an existing file, but
you probably know what you're doing.
> And while reading the file an exception is thrown on line 85:
> */usr/local/lib/python2.7/dist-packages/openpyxl/workbook/names/external.py
> in parse_ranges*
> def parse_ranges(xml):
> tree = fromstring(xml)
> book = tree.find('{%s}externalBook' % SHEET_MAIN_NS)
> names = book.find('{%s}definedNames' % SHEET_MAIN_NS)
> for n in safe_iterator(names, '{%s}definedName' % SHEET_MAIN_NS):
> yield ExternalRange(**n.attrib) *# <------ Throws:
> __init__()
> takes at least 3 arguments (2 given) --> n.attrib = {'name': 'FT'}*
> The problem arises with a call to:
> class openpyxl.workbook.names.external.External(name, refersTo,
> sheetId=None)
I don't know why I didn't do it at the time, but refersTo can be optional.
Simply setting the descriptor to String(allow_none=True) and making None
the default value for refersTo in the __init__ will avoid this. Just tried
this locally and it's fine but I get an exception elsewhere trying to save
the file.
I'm currently trying to avoid a 2.1.5 release (fear of the merge due to
copyright date changes) but as 2.2 won't be ready for a while (too many of
my fingers in too many pies), it's probably going to be inevitable.
> So, the refersTo-part is not in the dictionary n.attrib = {'name': 'FT'}
> This load_workbook function loaded without problems with openpyxl
> 2.0.5/1.8.4
Support for external links was only added in 2.1 and is still a bit rough,
so you get no errors in earlier versions because they are just ignored
(and stripped out). Seeing as you're disabling macros and working with the
values only, I suspect you're not interested in preserving everything in
the workbook anyway.
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