Skip to content

Sheet.names.add always on workbook level (Mac) #771

@wkschwartz

Description

@wkschwartz

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)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions