# Extraction Of Tabular Data From PDFs Using Python

<span class="w"></span>

# Extraction Of Tabular Data From PDFs Using Python


<noscript><img alt="Image for post" class="du ge dv gf t" src="https://miro.medium.com/max/2400/1*8jIibN00fj3Xm28ZWVpBmQ.jpeg" width="1200" height="800" srcSet="https://miro.medium.com/max/552/1*8jIibN00fj3Xm28ZWVpBmQ.jpeg 276w, https://miro.medium.com/max/1104/1*8jIibN00fj3Xm28ZWVpBmQ.jpeg 552w, https://miro.medium.com/max/1280/1*8jIibN00fj3Xm28ZWVpBmQ.jpeg 640w, https://miro.medium.com/max/1400/1*8jIibN00fj3Xm28ZWVpBmQ.jpeg 700w" sizes="700px"/></noscript>
                                             Pic source : Google

## How using python?

We can extract tabular data from PDFs using **camelot** library in python with >90% accuracy and we can save into csv or excel file.

## **What is camelot?**

Camelot is python based,MIT licensed ,open source library having following features:

*   Work well and configurable
*   We can debug and visualize using python matplotlib library
*   We can export output file as a csv or excel file
*   Camelot have excellent documentation

## **Installation :**

Using Conda:

*   conda install camelot-py -c conda forge

Using pip (after installing tk and ghostscript)

*   pip install camelot-py[cv]

<span class="w je jf jg dg jh ji jj jk jl ab">N</span>**ote** : It only works with text based PDFs not scanned documents.

## **Others PDFs Extraction Tools Available:**

*   Tabula- Java based,Open source
*   pdfplumber- Python,Opensource
*   pdftables- Python,proprietary and paid
*   Smallpdfs- Online and paid service

## Problems with these solutions:

*   We can not save output file as csv or excel.
*   These tools are not scalable and maintainable.

# Conclusion:

This article is inspired by speaker Vinayak Mehta in PyconIndia 2019.Thank you for reading. Please give it a try, have fun and let me know your feedback!
