views:

37

answers:

1

The documentation for xlrd here http://www.python-excel.org/ mentions that it is now possible in latest version, but does not say how.

+3  A: 

I'm not sure what you are actually reading; xlrd access to named ranges has been available for some years now (in version 0.6.0; latest version is 0.7.1) and came with full documentation ab initio.

This is the xlrd documentation link that's given on the http://www.python-excel.org/ page that you mentioned. Hit PageDown twice and you should see a section headed Named references, constants, formulas, and macros. This gives an overview and points you to documentation of the Book.name_* methods & the Name object, and to a demonstration script.

Note that this is the SVN trunk version of the documentation and applies to a future release; it may mention one extra convenience method that's not available in the current released version of xlrd (which you can get from PyPI) and which includes the relevant documentation file.

Update in response to """I got this far: someRange = book.name_map[u'somerange'][0] and now I want to iterate over it, grab values, get its dimensions, etc. Now what do I do? I tried dir(someRange) and help(someRange) and it has not helped much."""

What you are calling someRange is an instance of the Name class. You need to read the documentation of that class. It would help if you were to read the demonstration script xlrdnameAPIdemo.py and try running it over your xls file(s). Note that "get its dimensions" logically precedes "iterate over it, grab values"; the convenience method Name.area2d may be what you need.

John Machin
Ok John, so I got this far: `someRange = book.name_map[u'somerange'][0]` and now I want to iterate over it, grab values, get its dimensions, etc. Now what do I do? I tried `dir(someRange)` and `help(someRange)` and it has not helped much. Thanks.
Hamish Grubijan