From ae2888177e4c4d6d414ad8079d3d1408283f26c7 Mon Sep 17 00:00:00 2001 From: mjsqu Date: Wed, 4 Oct 2023 10:58:25 +1300 Subject: [PATCH] Implementing fix for https://github.com/ets/tap-spreadsheets-anywhere/issues/54 --- tap_spreadsheets_anywhere/format_handler.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tap_spreadsheets_anywhere/format_handler.py b/tap_spreadsheets_anywhere/format_handler.py index 3bf911f..91180e1 100644 --- a/tap_spreadsheets_anywhere/format_handler.py +++ b/tap_spreadsheets_anywhere/format_handler.py @@ -157,10 +157,11 @@ 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') if uri.lower().endswith(".xls"): + reader = get_streamreader(uri, universal_newlines=universal_newlines,newline=None, open_mode='rb') iterator = tap_spreadsheets_anywhere.excel_handler.get_legacy_row_iterator(table_spec, reader) else: + reader = get_streamreader(uri, universal_newlines=universal_newlines,newline=None, open_mode='rb', encoding=None) # Adding encoding `None` to ensure smart_open will use binary mode iterator = tap_spreadsheets_anywhere.excel_handler.get_row_iterator(table_spec, reader) elif format == 'json': reader = get_streamreader(uri, universal_newlines=universal_newlines, open_mode='r', encoding=encoding)