From dd6a696a512cad25808f646bd5aaa8fccdbfa74d Mon Sep 17 00:00:00 2001 From: Craig Astill Date: Tue, 16 May 2023 16:09:25 +0100 Subject: [PATCH] Fix `zipfile.BadZipFile` error when reading `.xlsx` files. Use the name of the `.xlsx`, when opening the workbook, since the following error is thrown when attempting to read the `io.TextIOWrapper` instance: `zipfile.BadZipFile: File is not a zip file when loading an .xlsx file` Issue: #54. --- tap_spreadsheets_anywhere/excel_handler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tap_spreadsheets_anywhere/excel_handler.py b/tap_spreadsheets_anywhere/excel_handler.py index ffd2b84..4aad321 100644 --- a/tap_spreadsheets_anywhere/excel_handler.py +++ b/tap_spreadsheets_anywhere/excel_handler.py @@ -69,7 +69,7 @@ def get_legacy_row_iterator(table_spec, file_handle): def get_row_iterator(table_spec, file_handle): - workbook = openpyxl.load_workbook(file_handle, read_only=True) + workbook = openpyxl.load_workbook(file_handle.name, read_only=True) if "worksheet_name" in table_spec: try: