Extract invoice data to Excel using Google Gemini, OCR, and Telegram
UnknownUnknown. This template uses community nodes we can't verify statically. Uses community nodes that can't be verified statically (unverified community packages are off by default in 3.0). Static check, last run 2026-10-19.
Community nodes
These come from third-party npm packages. In n8n 3.0 unverified community packages are off by default (N8N_UNVERIFIED_PACKAGES_ENABLED=false).
n8n-nodes-tesseractjs(Extract Text from Image (OCR))
Nodes used (10)
- Telegram Trigger
n8n-nodes-base.telegramTrigger - Code
n8n-nodes-base.code - Telegram
n8n-nodes-base.telegram - Edit Fields (Set)
n8n-nodes-base.set - Switch
n8n-nodes-base.switch - Extract from File
n8n-nodes-base.extractFromFile - Tesseract Node
n8n-nodes-tesseractjs.tesseractNode - If
n8n-nodes-base.if - Microsoft Excel 365
n8n-nodes-base.microsoftExcel - Google Gemini
@n8n/n8n-nodes-langchain.googleGemini
What it does
π 1. HOW IT WORKS This workflow automatically extracts structured data from invoices sent via Telegram (PDF or image) and saves it to Excel. 1. A user sends an invoice (PDF or image) to a Telegram bot 2. The workflow detects the file type (PDF or image) 3. For PDF: - Extracts text directly from the file - Falls back to OCR if needed 4. For images: - Uses OCR to extract text 5. The extracted text is cleaned and processed 6. AI (Google Gemini) converts the raw text into structured JSON data 7. The data is validated and formatted 8. Valid data is saved to Excel (Microsoft Excel or Google Sheets) 9. A confirmation message is sent back via Telegram This eliminates manual data entry and speeds up invoice processing. βοΈ 2. SETUP INSTRUCTIONS Prerequisites: 1. Telegram Bot - Create a bot using BotFather - Copy the Bot Token 2. Google Gemini API Key - Get API key from Google AI Studio 3. Excel / Google Sheets - Prepare a sheet with columns: invoicenumber, date, vendor, total, tax, items Setup Steps: 1. Configure Telegram Trigger Node - Paste your Bot Token 2. Configure File Download - Ensure binary data is correctly passed 3. Configure OCR - Use Tesseract OCR node or external OCR API 4. Configure Google Gemini Node - Add API key - Use provided prompt for structured extraction 5. Configure Excel / Google Sheets Node - Connect your account - Map fields correctly 6. Test Workflow - Send a sample invoice via Telegram 7. Activate Workflow π Requirements - n8n (self-hosted or cloud) - Telegram Bot Token - Google Gemini API Key - Excel 365 or Google Sheets π Output Example { "invoicenumber": "INV-001", "date": "2025-01-01", "vendor": "ABC Company", "totalamount": "100000", "tax": "10000", "items": { "name": "Service A", "quantity": "1", "price": "100000" } } π Use Cases - Invoice automation - Accounts payable automation - Financial data entry automation - Document digitization π‘ Notes - Works best with clear and high-quality images - OCR accuracy depends on image quality - AI improves extraction accuracy significantly