
Automated PDF Data Extraction from Gmail and Google Sheets Integration
Developed an automated solution for a client who received daily PDFs via email.
- Google Apps Script
- Gmail
- Google Sheets
- Python
Project Overview
This solution processes PDF attachments received by email, extracts relevant information, and transfers the data into a designated Google Sheet. It also supports manual PDF uploads and scheduled email fetching.
Technology: Gmail, Google Sheets, Python, FastAPI
01. The Challenge
Processing daily PDF attachments manually requires downloading files, extracting important information, validating data, and entering it into Google Sheets.
02. The Solution
An automated workflow was developed to fetch PDF attachments from Gmail, extract relevant fields, validate the data, and populate Google Sheets. A manual upload interface is also available.
03. Key Features
- User Authentication: Provides a login mechanism for users.
- PDF Upload: Allows users to upload PDF files manually.
- Data Extraction: Extracts fields such as order code, shipping address, and product details.
- Google Sheets Integration: Transfers extracted data into a designated spreadsheet.
- Scheduled Email Fetching: Retrieves PDF attachments from email at scheduled intervals.
- Data Validation: Checks data consistency and accuracy.
04. How It Works
Scheduled workflow
- Fetch PDF attachments from Gmail.
- Parse the PDF and extract relevant data.
- Validate the extracted information.
- Transfer the data to Google Sheets.
Manual workflow
- User logs in.
- User uploads a PDF.
- The backend processes the file and sends the extracted data to Google Sheets.
05. Workflow

Manual Upload:

06. Implementation
The FastAPI backend handles file uploads, invoice processing, and spreadsheet integration. The process.py module processes uploaded files, converts extracted invoice data into a dataframe, and passes it to the Google Sheets client.

07. Outcome
The solution reduces manual PDF processing and data-entry work by combining scheduled email fetching, manual uploads, data extraction, validation, and Google Sheets integration.