Extract Tables from a PDF and Save into a CSV
# first of all install the 2 dependencies
# pip install tk
# pip install ghostscript
# and then
# pip install camelot-py
import camelot
table = camelot.read_pdf("table.pdf", pages="1")
print(table)
# exports the list of tables to specified file format
table.export("mytab.csv", f="csv", compress=True)
# only the specified table is exported
table[0].to_csv("mytab.csv")
Comments
Post a Comment
Write something to CodeWithAbdur!