title: Python XLRD Get Column Values by Column Names into List of Dictionaries
body: <p>I have a xlsx file in which the data does not start at first row or column. It looks like this.</p>
  
  <p><a href="https://i.stack.imgur.com/T0NGA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/T0NGA.png" alt="enter image description here"></a></p>
  
  <p>Only the column names are known here. The data ends whenever there is "**********" in first column. 
  I need the output in a list of dictionaries, like below.</p>
  
  <p>'ListOfDict':
      [ { 'A':1, 'B':'ABC', 'C':'Very Good', 'D':'Hardware', 'E':200.2 },
        { 'A':2, 'B':'DEF', 'C':'Not so good', 'D':'Software', 'E':100.1}]</p>
  
  <p>I could figure out the column names. But could not get the values. Here is my code.</p>
  
  <pre><code>import xlrd
  from itertools import product
  
  wb = xlrd.open_workbook(filename)
  ws = wb.sheet_by_index(0)
  
  for row_index, col_index in product(xrange(ws.nrows), xrange(ws.ncols)):
      if ws.cell(row_index, col_index).value == 'A':
          print "({}, {})".format(row_index, col_index)
          break
  
  key1 = [ws.cell(row_index, col_ind).value for col_ind in range(col_index, ws.ncols)]
  
  val = [ws.cell(row_index + i, col_ind).value 
         for i in range(row_index + 1, ws.nrows) 
         for col_ind in range(col_index, ws.ncols)]
  </code></pre>
  
  <p>But that gives error "list index out of range"</p>
  
  <p>Please help.
  Thank you.</p>