From a5a803533941f991ef9989f9c37a1a5dd283c7c4 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 bef07b3..eb3c8b2 100644 --- a/tap_spreadsheets_anywhere/excel_handler.py +++ b/tap_spreadsheets_anywhere/excel_handler.py @@ -62,7 +62,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: