Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions scripts/GST- Details extract from invoice pdf/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This script uses Regular Expression to find the GST numbers present in the Invoice pdf

# dependencies
pip install google-colab
pip install pdfplumber
pip install pandas

you have to provide the path to your drive folder. Works better on Google Colab
22 changes: 22 additions & 0 deletions scripts/GST- Details extract from invoice pdf/gst.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import pdfplumber
import pandas as pd
from google.colab import drive
import os
drive.mount('/content/gdrive')
os.chdir("/content/gdrive/PATH TO FOLDER CONTAINING INVOICES PDF")
os.getcwd()
invoices = os.listdir()
print(invoices)
import re
df = []
for inv in invoices:
gst = pdfplumber.open(inv) #it will open each file in the directory
page = gst.pages[0] #selecting the first page
text = page.extract_text()
gst_no = re.compile(r'\d{2}[A-Z]{5}\d{4}[A-Z]{1}[A-Z\d]{1}[Z]{1}[A-Z\d]{1}')
m =gst_no.findall(text)
print(m)
df = df+[m]
gstin = pd.DataFrame(df)
gstin
gstin.to_csv('gstin.csv', index=False)