title: xlrd lookup Excel values in other Excel file
body: <p>I am playing around with xlrd and I am having some difficulties. The main idea of what I am trying to do is to open an Excel file, read the first column contents into an array and use that array to search in another Excel file. When the value is found it should return the contents of three cells from the second Excel file. my code:</p>
  
  <pre><code>import xlrd
  import os.path
  from docx import Document
  
  document = Document()
  
  registry = xlrd.open_workbook('/root/Desktop/registry.xlsx')
  findings = xlrd.open_workbook('/root/Desktop/findings.xlsx')
  
  findings_sheet = findings.sheet_by_index(0)
  registry_sheet = registry.sheet_by_index(0)
  
  num_rows = findings.nrows - 1
  curr_row = 0
  
  findings_array = []
  
  while curr_row &lt; num_rows:
     row = findings.row(curr_row)
     findings_array += row
     curr_row += 1
  
  
  for finding in findings_array:
     for r in range(first_sheet.nrows):
         cell_col1=first_sheet.cell(rowx=r,colx=0).value
         if cell_col1 == finding:
  
             print first_sheet.cell(r,3)
             print first_sheet.cell(r,4)
             print first_sheet.cell(r,5)
  else:
      print "Finding not found"
  </code></pre>
  
  <p>Currently it doesn't work. If i replace <code>if cell_col1 == finding:</code> into <code>if cell_col1 == "ABC":</code> then the condition works but it prints out the cells 5 times which is the number of findings in my array.</p>
  
  <p>I know that I have issues in my code but I am not a programmer and I am kinda stuck.</p>