Overview
The names attribute of a Sheet is always empty on Mac with Excel 2011 and Python 3.6. This happens whether I make a new workbook from scratch or open an existing workbook that already contains named ranges. Adding a named range using the names.add method works from Excel's point of view—the cell takes on the name assigned to it—but not from Python's—names remains empty.
I do not have Windows. Is this reproducible in Windows?
Reproducing the error
The following code makes a workbook in which cell A1 on the first worksheet is the named range "cell". If you run this code, you can check in Excel that it works. However the last line, in which sheet.names evaluates to the empty list, should produce the list [<Name 'cell': =Sheet1!$A$1>].
>>> import xlwings
>>> workbook = xlwings.Book()
>>> sheet = workbook.sheets[0]
>>> sheet.names # Correctly empty
[]
>>> sheet.names.add("cell", "=Sheet1!$A$1")
<Name 'cell': =Sheet1!$A$1>
>>> sheet.names # Should be [<Name 'cell': =Sheet1!$A$1>] instead
[]
Versions
Python 3.6.3 (default, Oct 4 2017, 06:09:15)
xlwings 0.11.4
macOS 10.12.6
Excel for Mac 2011 version 14.2.0 (120402)
Overview
The
namesattribute of aSheetis always empty on Mac with Excel 2011 and Python 3.6. This happens whether I make a new workbook from scratch or open an existing workbook that already contains named ranges. Adding a named range using thenames.addmethod works from Excel's point of view—the cell takes on the name assigned to it—but not from Python's—namesremains empty.I do not have Windows. Is this reproducible in Windows?
Reproducing the error
The following code makes a workbook in which cell A1 on the first worksheet is the named range "cell". If you run this code, you can check in Excel that it works. However the last line, in which
sheet.namesevaluates to the empty list, should produce the list[<Name 'cell': =Sheet1!$A$1>].Versions
Python 3.6.3 (default, Oct 4 2017, 06:09:15)
xlwings 0.11.4
macOS 10.12.6
Excel for Mac 2011 version 14.2.0 (120402)