Skip to content

Commit

Permalink
Merge pull request #861 from wireservice/encoding_override
Browse files Browse the repository at this point in the history
in2csv adds a --encoding-xls option to specify the encoding of the in…
  • Loading branch information
jpmckinney authored Jul 15, 2017
2 parents 6add000 + 12cffd6 commit da1f330
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
1.0.3
-----

Improvements:

* :doc:`/scripts/in2csv` adds a :code:`--encoding-xls` option to specify the encoding of the input XLS file.

Fixes:

* :doc:`/scripts/csvgrep` accepts utf-8 arguments to the :code:`--match` and :code:`--regex` options in Python 2.
Expand Down
4 changes: 3 additions & 1 deletion csvkit/utilities/in2csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ def option_parser(bytestring):
help='The name of the Excel sheet to operate on.')
self.argparser.add_argument('--write-sheets', dest='write_sheets', type=option_parser,
help='The names of the Excel sheets to write to files, or "-" to write all sheets.')
self.argparser.add_argument('--encoding-xls', dest='encoding_xls',
help='Specify the encoding of the input XLS file.')
self.argparser.add_argument('-y', '--snifflimit', dest='sniff_limit', type=int,
help='Limit CSV dialect sniffing to the specified number of bytes. Specify "0" to disable sniffing entirely.')
self.argparser.add_argument('-I', '--no-inference', dest='no_inference', action='store_true',
Expand Down Expand Up @@ -139,7 +141,7 @@ def main(self):
elif filetype == 'ndjson':
table = agate.Table.from_json(self.input_file, key=self.args.key, newline=True, **kwargs)
elif filetype == 'xls':
table = agate.Table.from_xls(self.input_file, sheet=self.args.sheet, **kwargs)
table = agate.Table.from_xls(self.input_file, sheet=self.args.sheet, encoding_override=self.args.encoding_xls, **kwargs)
elif filetype == 'xlsx':
table = agate.Table.from_xlsx(self.input_file, sheet=self.args.sheet, **kwargs)
elif filetype == 'dbf':
Expand Down
8 changes: 3 additions & 5 deletions requirements-py3.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
agate>=1.5.5
# Using HEAD until agate-excel>0.2.0 is available.
# agate-excel>=0.2.0
# Using HEAD until agate-excel>=0.2.2 is available.
# agate-excel>=0.2.2
-e git+https://github.com/wireservice/agate-excel.git#egg=agateexcel
agate-dbf>=0.2.0
# Using HEAD until agate-sql>0.5.0 is available.
# agate-excel>=0.2.0
-e git+https://github.com/wireservice/agate-sql.git#egg=agatesql
agate-sql>=0.5.2
six>=1.6.1

# Development
Expand Down

0 comments on commit da1f330

Please sign in to comment.