Extract purchase order data to Excel via Telegram using OCR and Google Gemini
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
Quick Overview This workflow accepts purchase order PDFs or images via Telegram, extracts text using PDF parsing or Tesseract OCR, uses Google Gemini to convert the text into structured JSON, validates key fields, and appends the results to a Microsoft Excel table in OneDrive, then notifies the sender. How it works 1. Triggers when a new Telegram message arrives with a document or photo attachment. 2. Detects whether the attachment is a PDF or an image and immediately replies in Telegram that processing has started (or sends an invalid-file message if unsupported). 3. Downloads the file from Telegram and extracts text using built-in PDF text extraction for PDFs or Tesseract OCR for images. 4. Cleans the extracted text and sends it to Google Gemini with instructions to return purchase order fields and line items as valid JSON. 5. Parses the Gemini response into JSON and validates that the PO number exists and the total amount is numeric. 6. If valid, formats the data for a Microsoft Excel table, appends it to the selected workbook/table in OneDrive, and sends a success message in Telegram. 7. If invalid, sends a Telegram message listing the validation errors. Setup 1. Connect your Telegram Bot credential and start a chat with the bot so it can receive PDFs/images and reply to your chat. 2. Add a Google Gemini (PaLM) API credential and ensure the model ID in the prompt node matches an available Gemini model in your account. 3. Connect Microsoft Excel OAuth2 credentials, then select the target OneDrive workbook, worksheet, and table where rows should be appended. 4. (Optional) Adjust the Gemini prompt fields, validation rules, and the Excel column mappings to match your purchase order format and table schema.