I am converting excel(xlsx) file to CSV using PYTHON and i am getting the following error message.
Code: import xlrd import csv
with xlrd.open_workbook('a_file.xlsx') as wb:
sh = wb.sheet_by_index(0) # or wb.sheet_by_name('name_of_the_sheet_here')
with open('a_file.csv', 'wb') as f:
c = csv.writer(f)
for r in range(sh.nrows):
c.writerow(sh.row_values(r))
Error Message: Traceback (most recent call last): File "C:\Python27\Scripts\1.py", line 9, in c.writerow(sh.row_values(r)) UnicodeEncodeError: 'ascii' codec can't encode character u'\xbd' in position 4: ordinal not in range(128)
Any light on resolving the error?