Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add --sheet option support for XLS

  • Loading branch information...
commit fae2725366903e22fbca0e6c4a0c42d2c61514b8 1 parent 11e9911
James McKinney jpmckinney authored
Showing with 5 additions and 3 deletions.
  1. +4 −1 csvkit/convert/xls.py
  2. +1 −2  csvkit/convert/xlsx.py
5 csvkit/convert/xls.py
View
@@ -125,7 +125,10 @@ def xls2csv(f, **kwargs):
Convert an Excel .xls file to csv.
"""
book = xlrd.open_workbook(file_contents=f.read())
- sheet = book.sheet_by_index(0)
+ if 'sheet' in kwargs:
+ sheet = book.sheet_by_name(kwargs['sheet'])
+ else:
+ sheet = book.sheet_by_index(0)
tab = table.Table()
3  csvkit/convert/xlsx.py
View
@@ -37,8 +37,7 @@ def xlsx2csv(f, output=None, **kwargs):
book = load_workbook(f, use_iterators=True)
if 'sheet' in kwargs:
- sheetn = kwargs['sheet']
- sheet = book.get_sheet_by_name(sheetn)
+ sheet = book.get_sheet_by_name(kwargs['sheet'])
else:
sheet = book.get_active_sheet()
Please sign in to comment.
Something went wrong with that request. Please try again.