import camelot
import sys

# PDF file to extract tables from (from command-line)
file = sys.argv[1]

# extract all the tables in the PDF file
tables = camelot.read_pdf(file)

# number of tables extracted
print("Total tables extracted:", tables.n)

# print the first table as Pandas DataFrame
print(tables[0].df)

# export individually
tables[0].to_csv("foo.csv")

# or export all in a zip
tables.export("foo.csv", f="csv", compress=True)

# export to HTML
tables.export("foo.html", f="html")
import camelot
import sys

# PDF file to extract tables from (from command-line)
file = sys.argv[1]

# extract all the tables in the PDF file
tables = camelot.read_pdf(file)

# number of tables extracted
print("Total tables extracted:", tables.n)

# print the first table as Pandas DataFrame
print(tables[0].df)

# export individually
tables[0].to_csv("foo.csv")

# or export all in a zip
tables.export("foo.csv", f="csv", compress=True)

# export to HTML
tables.export("foo.html", f="html")
# PDF file to extract tables from (from command-line) # extract all the tables in the PDF file # number of tables extracted # print the first table as Pandas DataFrame # export individually # or export all in a zip # export to HTML