Key Takeaways
- We built an AI-powered automation tool using Google Apps Script and Gemini 2.5 Flash-Lite that parses PDFs, validates data, and submits invoices automatically.
- The solution saved our client ~1 FTE per week and eliminated manual data entry errors.
- Choosing the right LLM matters:
- U.S. models like GPT-4o and Gemini deliver excellent accuracy but come at a higher cost.
- Chinese LLMs like DeepSeek, Qwen, and Yi-Lightning provide similar structured parsing at 10×–50× lower cost.
- Leveraging cost-efficient AI automation can give companies a significant competitive edge.
Introduction
Invoice processing used to be one of the biggest hidden productivity drains. Finance teams spent hours every week opening PDFs, copying invoice data into spreadsheets, validating line items, and manually submitting records into their ERP systems.
We recently helped a client replace this tedious process with an AI-powered PDF automation tool built using Google Apps Script and Gemini AI.
Results:
- 1 full-time equivalent (FTE) saved every week
- Zero manual entry errors
- PDF-to-submission in seconds
The Problem
Our client received hundreds of PDF invoices weekly. The finance team spent hours:
- Opening each PDF manually
- Copying vendor names, invoice totals, and line items into spreadsheets
- Validating against POs and vendor IDs
- Submitting invoices into their ERP system
This workflow was repetitive, error-prone, and expensive.
The Solution: AI-Powered Automation
We built a serverless workflow using Google Apps Script and Gemini 2.5 Flash-Lite that handles everything from PDF parsing to ERP submission.
1) Smart PDF Ingestion
Invoices are automatically collected from:
- Email inboxes
- Google Drive watch folders
- Cloud storage integrations
2) AI-Powered PDF Parsing
Using Gemini’s multimodal capability, the tool reads PDFs directly and returns structured JSON with:
- Invoice numbers and dates
- Vendor details
- Line items, tax, and totals
- Payment terms and PO numbers
3) Real-Time Validation
Before submission, the tool applies business rules to ensure data integrity:
- Vendor IDs are cross-checked
- PO totals match invoice totals
- Duplicates are detected automatically
4) Automatic ERP Submission
Once validated, invoices are pushed into the ERP system via API, reducing human touchpoints to exception handling only.
Choosing the Right AI Model: Cost vs Accuracy
When benchmarking LLMs for PDF parsing, we discovered significant cost differences: