in2csv reading sheets with utf-8 names
Created by: Fil
sheet names in utf-8, containing an accent
The command in2csv --sheet=BÉBÉ file.xls
raises: usr/local/lib/python2.7/site-packages/xlrd/book.py:439: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
No sheet named <'B\xc3\x89B\xc3\x89'>
Quick fix in in2csv.py:
if self.args.sheet:
kwargs['sheet'] = self.args.sheet.decode('utf-8')
(I think this bug and the fix are because I'm using python2.7)
Another way of getting this sheet is by adding an argument sheetnum
with:
self.argparser.add_argument('--sheetnum', dest='sheetnum',
help='The name of the Excel sheet to operate on.')
…
if self.args.sheetnum:
kwargs['sheet'] = int(float(self.args.sheetnum))