Back to Templates

Extract Invoice Data from Telegram to Google Sheets with OCR & Gemini AI

Created by

Created by: Anir Agram || not0lucky

Anir Agram

Last update

Last update 16 hours ago

Share


🛡️📥 Telegram Invoice Agent → 🔎 OCR → 🤖 AI Parsing → 📄 Google Sheets + 🗂️ Drive

What this workflow does

  • 🤖 Captures invoices from Telegram and auto-downloads PDFs/images.​
  • 🔎 Runs OCR, then uses AI to structure clean invoice fields.​
  • 📄 Appends parsed data to a Google Sheets “Invoice Database.”​
  • 🗂️ Uploads the original file to Google Drive with a neat name.​
  • 💬 Sends a friendly Telegram summary with totals, due date, notes, and link.​

Why it’s useful

  • ⚡ Faster bookkeeping with zero manual copy-paste.​
  • 🧱 Consistent schema for reliable reporting and pivots.​
  • 👥 Team-friendly drop-and-log via Telegram.​
  • 🧩 Easy to extend with approvals, ERP/CRM sync, or vendor routing.​

How it works

  • 📲 Telegram Trigger → file received.​
  • 🌐 HTTP OCR (OCR.space) → text extracted.​
  • 🤖 AI Agent → maps to strict JSON schema.​
  • 📄 Google Sheets → appends structured row.​
  • 🗂️ Google Drive → saves original invoice.​
  • 💬 Telegram → concise confirmation and links.​

What you’ll need

  • 🤖 Telegram Bot token.​
  • 🔑 OCR API key (OCR.space: free tier; upgrade for volume/accuracy).​
  • 🔐 Google OAuth for Sheets + Drive.​
  • 🧠 LLM account (e.g., Gemini/OpenAI-compatible).​

Setup steps

  • 🔗 Connect credentials: Telegram, Google, OCR, AI.​
  • 📄 Prepare Sheet columns: Invoice Number, Date, Total Amount ($), Billing Address, Due Date, Notes.​
  • 🧭 Update sheet ID and Drive folder ID.​
  • 🧪 Test: send a sample invoice and validate OCR, AI output, row append, and Drive link.​

Customization ideas

  • 🎯 Higher accuracy OCR: swap to Google Vision.​
  • 📊 Line items: extract into a second tab for analytics.​
  • ✅ Approvals: add Telegram keyboard confirmation before write.​
  • 🧯 Robustness: IF/Retry on empty OCR; user prompt to retake photo.​

Who it’s for

  • 🧑‍💻 Freelancers/agencies needing fast invoice intake via Telegram.
  • 🧾 Small finance teams wanting a searchable ledger with links to originals.​
  • 🏗️ Builders extending to ERPs/CRMs and custom accounting flows.​

Want help customizing?

📧 [email protected]
🔗 Linkedin