n8nflow.net logo

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

by Anir Agramβ€’Updated: Last update 6 days agoβ€’Source: n8n.io
Loading workflow viewer...

Getting Started

πŸ›‘οΈπŸ“₯ 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