From 1a62e5b4bfb1ca79f6a83ce47db43d4e33392654 Mon Sep 17 00:00:00 2001 From: Peter Spiro Date: Sun, 3 Dec 2023 10:41:14 -0800 Subject: [PATCH] restore encoding to None for excel reader --- tap_spreadsheets_anywhere/format_handler.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tap_spreadsheets_anywhere/format_handler.py b/tap_spreadsheets_anywhere/format_handler.py index 3bf911f..bc29a39 100644 --- a/tap_spreadsheets_anywhere/format_handler.py +++ b/tap_spreadsheets_anywhere/format_handler.py @@ -157,7 +157,9 @@ def get_row_iterator(table_spec, uri): reader = get_streamreader(uri, universal_newlines=universal_newlines, open_mode='r', encoding=encoding) iterator = tap_spreadsheets_anywhere.csv_handler.get_row_iterator(table_spec, reader) elif format == 'excel': - reader = get_streamreader(uri, universal_newlines=universal_newlines,newline=None, open_mode='rb') + reader = get_streamreader(uri, universal_newlines=universal_newlines,newline=None, open_mode='rb', + # encoding must be None to prevent smart_open from ignoring binary mode + encoding=None) if uri.lower().endswith(".xls"): iterator = tap_spreadsheets_anywhere.excel_handler.get_legacy_row_iterator(table_spec, reader) else: