Last active
May 8, 2024 13:28
-
-
Save Intelrunner/654df57f0fb27818001ccebb7e4e3b75 to your computer and use it in GitHub Desktop.
Revisions
-
Intelrunner revised this gist
May 8, 2024 . 1 changed file with 10 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,17 @@ """ Instructions - Download to folder - > Run "pip3 freeze > requirements.txt" - > Run pip3 "install -r requirements.txt" - > run python3 -m main.py - Enjoy """ from tabula import convert_into, read_pdf import os import tabula # ask for the file name file_name = input("Enter the file name or relative path: ") df = tabula.read_pdf(file_name, pages="all", encoding='utf-8', multiple_tables=False) if not os.path.exists("output"): -
Intelrunner created this gist
May 8, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ from tabula import convert_into, read_pdf import os import tabula # ask for the file name file_name = input("Enter the file name: ") df = tabula.read_pdf(file_name, pages="all", encoding='utf-8', multiple_tables=False) if not os.path.exists("output"): os.makedirs("output") print("Directory created") for i, table in enumerate(df): table.to_csv(f"output/table_{i}.csv", index=False) print(f"Table {i} saved to CSV") else: print("Directory already exists") for i, table in enumerate(df): table.to_csv(f"output/table_{i}.csv", index=False) print(f"Table {i} saved to CSV")