Help me improve this function
<p>I have written the following function that does the following -</p>

<ol>
<li>Read values in a column from an excel file</li>
<li>Each cell may have strings separated by comma</li>
<li>Two cells may share the same values e.g. cell 1 may have a,b and cell 2 may have b,c</li>
<li>The final goal is to create one single list - a,b,c</li>
</ol>

<p>Here is my function</p>

<pre>
def readxlsfile(input):
  book = xlrd.open_workbook(input)
  sh = book.sheet_by_name(sheet_name)
  headers = sh.row(0) # Default row is 0 as all the headers in the 0th row

  # Get the column
  for header in headers:
    if header.value.find(key) != -1:
      columnid = headers.index(header) # Got the column for required key. keys are unique
      break

  # Create temp list of all the values with possible duplicates
  temp_amcells = []
  for am in sh.col_slice(columnid, start_rowx=1):
      if am != '':
        am_elements = string.split(am.value.strip(), ',')
        temp_amcells.extend(am_elements)

  # Prepare final list
  for temp_am_element in temp_amcells:
    if temp_am_element.strip() not in final_amlist:
      final_amlist.append(temp_am_element.strip())

</pre>

<p>This code works. But I would like to know if I can make it more concise/readable/efficient.
Also, another issue I want to solve is -<br>
When I print the list, there is a blank line at the top of the file. Now, some of the cells may contain nothing. But I thought I was taking care of them by this comparison - <code>am != '':</code></p>

<p>Thanks in advance.</p>
