Skip to content

Commit

Permalink
Fix build-in CLI extraction to Excel
Browse files Browse the repository at this point in the history
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".
  • Loading branch information
ipa-bak committed May 17, 2023
1 parent e3b9c73 commit 725497c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions camelot/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 725497c

Please sign in to comment.