Named references, constants, formulas, and macros¶
A name is used to refer to a cell, a group of cells, a constant value, a formula, or a macro. Usually the scope of a name is global across the whole workbook. However it can be local to a worksheet. For example, if the sales figures are in different cells in different sheets, the user may define the name “Sales” in each sheet. There are built-in names, like “Print_Area” and “Print_Titles”; these two are naturally local to a sheet.
To inspect the names with a user interface like MS Excel, OOo Calc, or Gnumeric, click on Insert -> Names -> Define. This will show the global names, plus those local to the currently selected sheet.
Book object provides two dictionaries (
Book.name_and_scope_map) and a list (
allow various ways of accessing the
There is one
Name object for each NAME record found in the workbook.
Name objects have many attributes, several of which are relevant only
In the examples directory you will find
showcases the many different ways that names can be used, and
xlrdnamesAPIdemo.py which offers 3 different queries for inspecting
the names in your files, and shows how to extract whatever a name is
referring to. There is currently one “convenience method”,
Name.cell(), which extracts the value in the case where the name
refers to a single cell. The source code for
Name.cell() is an extra
source of information on how the
Name attributes hang together.
Name information is not extracted from files older than
Excel 5.0 (
Book.biff_version < 50).