From 725497c63a89a3b9c4635ed567f2008abe16ecb3 Mon Sep 17 00:00:00 2001 From: ipa-bak Date: Wed, 17 May 2023 15:14:29 +0200 Subject: [PATCH] Fix build-in CLI extraction to Excel The calls to the Pandas Excel writer where no longer compatible with recent versions. * The to_excel() method does not have an "encoding" keyword argument. * The method to save to file is now called "close" instead of "save". --- camelot/core.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/camelot/core.py b/camelot/core.py index 58a98efd..15eb2615 100644 --- a/camelot/core.py +++ b/camelot/core.py @@ -748,8 +748,8 @@ def export(self, path, f="csv", compress=False): writer = pd.ExcelWriter(filepath) for table in self._tables: sheet_name = f"page-{table.page}-table-{table.order}" - table.df.to_excel(writer, sheet_name=sheet_name, encoding="utf-8") - writer.save() + table.df.to_excel(writer, sheet_name=sheet_name) + writer.close() if compress: zipname = os.path.join(os.path.dirname(path), root) + ".zip" with zipfile.ZipFile(zipname, "w", allowZip64=True) as z: