title: Count number of occurences of specific words in Excel sheet using python & xlrd
body: <p>I am writing a python script that finds excel sheets that are in the same directory as the script (I have about 10) and counts the number of occurrences of specific words in those files (like cloud, vmware, python etc.) then writes the total count of each word to a text file. I'm using python and xlrd to do this. Each excel file has a sheet called details which is where the info is. There are 2 columns and roughly 26 rows to each file. </p>
  
  <pre><code>for filename in os.listdir(path):
  
  
  if filename.find('xls') != -1:
      print filename        
      workbook=xlrd.open_workbook(filename)
      sheet=workbook.sheet_by_name("Details")
      values = []
      for row in range(sheet.nrows):
          for col in range(sheet.ncols):
              values.append(unicode(sheet.cell(row,col).value))
  
              print values.count("cloud")
  </code></pre>
  
  <p>I am using a for loop to go through both columns and all rows of every file and then add all the values to a list. I then do the count using the list called values. I'll need a tally of some sort to total up the count of each word as everything is happening in a for loop which otherwise shows a count for each file. But unfortunately it doesn't work for some reason. I also need to set up a like a dictionary or something with all the words that I want to be counted but I don't know how to do this. Any help would be appreciated.</p>