← Back

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
Works with
  • 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

  1. Fetch PDF attachments from Gmail.
  2. Parse the PDF and extract relevant data.
  3. Validate the extracted information.
  4. Transfer the data to Google Sheets.

Manual workflow

  1. User logs in.
  2. User uploads a PDF.
  3. The backend processes the file and sends the extracted data to Google Sheets.

05. Workflow

5e5729a4f078d5e363952495.png
f21e056b58dcd147327c3c7d.png

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.

The FastAPI backend that handles the upload, invoice parsing, and Sheets integration.

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.