title: Output Excel worksheet with special characters to CSV
body: <p>I have an Excel file with multiple worksheets. I want to take a specific worksheet from the file and save this as a CSV file, delimited by commas ( I haven't gotten this far as yet). The worksheet contains data with special characters similar to last column on the right below. I don't mind ignoring these characters.</p>
  
  <pre><code>    **DateStamp Country ComputerName    Domain    IPAddress   OperatingSystem**
      2017-05-24  USA     Computer1       Domain1   1.2.3.4     Windows 2008
      2017-05-24  England Computer2       Domain2   1.2.3.5     Windows Server® 2008
  </code></pre>
  
  <p>My code so far is:</p>
  
  <pre><code>import os
  import xlrd
  import sys
  
  file = 'path/to/my/file.xlsx'
  workbook = xlrd.open_workbook(file)
  sheet = workbook.sheet_by_name('Data')
  
  for rowx in range(sheet.nrows):
      coldata = sheet.row_values(rowx)
      coldata = " ".join(str(x) for x in coldata).encode('ascii')
  with open ('/path/log.txt','a') as results:
      results.write(coldata)
  results.close()
  </code></pre>
  
  <p>I am having to convert the data to string as otherwise it will include the <strong>u'</strong> next to each field, which i dont want in my CSV. On trying to do that I am encountering various errors.
  The error I am getting is:</p>
  
  <pre><code>UnicodeEncodeError: 'ascii' codec can't encode character u'\xae' in position 14: ordinal not in range(128)
  </code></pre>
  
  <p>If i try to ignore the characters, i land up with this:</p>
  
  <pre><code>colsdata = colsdata.decode('ascii','ignore')
  Attribute error: 'list' object has no attribute 'decode'
  </code></pre>
  
  <p>These errors take place before I am able to write to the log.</p>
  
  <p>Please may I get some assistance. Thanks!</p>