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

Popular posts from this blog

Quotation marks to wrap an element in HTML

The Basic Structure of a Full-Stack Web App

Unlocking Web Design: A Guide to Mastering CSS Layout Modes