title: Python xlrd Named Range Value
body: <p>Using XLRD in Python to read from Excel.</p>
  
  <p>Simple scenario. I have a cell with a value and this is associated with a named range.</p>
  
  <p>NamedRange "Foo" = Sheet1!$A$1
  The value in A1 is "Bar"</p>
  
  <pre><code>book =xlrd.open_workbook("")
  
  rng =  book.name_map['foo'][0]  # lower case for some reason.
  
  print rng.???   # how to print the cell value bar??
  </code></pre>
  
  <p>I just want to reference the Named range "Foo" in python code and print out the value "Bar" of the cell.</p>
  
  <p>EDIT:
  Here is another more complete example:</p>
  
  <pre><code>import xlrd
  
  workbook = xlrd.open_workbook('/path/to/metester.xls')
  cell_obj = workbook.name_and_scope_map.get(('sales', -1))
  # this does print Sheet1!$A$1
  print cell_obj.formula_text
  # this raises the NoneTypeError
  print cell_obj.cell()
  </code></pre>
  
  <p>formula_text is there to ensure excel can read the file. In my case the named cell is "sales" in Sheet1, cell A1.</p>
  
  <p>Returns:</p>
  
  <pre><code>Sheet1!$A$1
  Traceback (most recent call last):
    File "tester.py", line 7, in &lt;module&gt;
      print cell_obj.cell()
    File "/usr/local/lib/python2.7/dist-packages/xlrd/book.py", line 253, in cell
      self.dump(self.book.logfile,
  AttributeError: 'NoneType' object has no attribute 'logfile'
  </code></pre>