Skip to main content

Extract invoice data with Google Gemini, Google Sheets, and Telegram

Workflow preview

Workflow preview
100%
Extract invoice data with Google Gemini, Google Sheets, and Telegram preview
Open on n8n.io

1. Workflow Overview

Quick overview This workflow accepts invoice PDFs or images from an n8n Form or Telegram, uses Google Gemini to OCR and extract structured invoice fields and line items, appends the results to Goog...

Best for

  • Invoice Processing automation workflows
  • AI Summarization automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.formtrigger, n8n-nodes-base.code, n8n-nodes-base.if, n8n-nodes-base.googlesheets, @n8n/n8n-nodes-langchain.googlegemini, n8n-nodes-base.splitout, n8n-nodes-base.telegramtrigger, n8n-nodes-base.telegram

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Hồ Đình Huy.

Original n8n.io source

1.1 Workflow description

Title
Extract invoice data with Google Gemini, Google Sheets, and Telegram
Workflow name
Extract invoice data with Google Gemini, Google Sheets, and Telegram

Quick overview

This workflow accepts invoice PDFs or images from an n8n Form or Telegram, uses Google Gemini to OCR and extract structured invoice fields and line items, appends the results to Google Sheets, and sends a success or rejection notification via Telegram.

How it works

  1. Receives an invoice file upload either from an n8n Form or from a Telegram bot message.
  2. Validates that the incoming file exists and is a supported PDF or image format, otherwise prepares a rejection message.
  3. Uploads the file to Google Gemini and routes it to Gemini document analysis for PDFs or image analysis for images.
  4. Parses Gemini’s JSON response, normalizes dates and numeric fields, and ensures line items are present as an array.
  5. Splits the extracted line items into rows and appends the invoice data to an Invoices worksheet in Google Sheets.
  6. Builds a processing summary and sends a Telegram notification for success, or sends the prepared rejection message for invalid files.

Setup

  1. Add a Google Gemini (PaLM) API credential and select a Gemini model (for example, models/gemini-2.5-flash) in the Gemini nodes.
  2. Add a Google Sheets OAuth2 credential and replace REPLACE_WITH_GOOGLE_SHEET_ID with your spreadsheet ID, ensuring an Invoices sheet exists.
  3. Add a Telegram bot credential, set REPLACE_WITH_TELEGRAM_CHAT_ID, and (optionally) message your bot once so it can send you notifications.
  4. If using the n8n Form entry point, open the form URL for the “invoice” path and use it as the upload page for PDF/image invoices.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Upload Invoice Form

Type / Role
n8n-nodes-base.formTrigger - formTrigger
Config choices
Version 2.5

Block 2 - Prepare Invoice Input

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 3 - File Is Processable?

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.3

Block 4 - Build Invalid File Result

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 5 - Append Invoice to Google Sheets

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.7

Block 6 - Upload a media file

Type / Role
@n8n/n8n-nodes-langchain.googleGemini - googleGemini
Config choices
Version 1.2

Block 7 - Analyze document

Type / Role
@n8n/n8n-nodes-langchain.googleGemini - googleGemini
Config choices
Version 1.2

Block 8 - If

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.3

Block 9 - Analyze an image

Type / Role
@n8n/n8n-nodes-langchain.googleGemini - googleGemini
Config choices
Version 1.2

Block 10 - Normalize and Validate

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 11 - Split Out

Type / Role
n8n-nodes-base.splitOut - splitOut
Config choices
Version 1

Block 12 - Telegram Trigger

Type / Role
n8n-nodes-base.telegramTrigger - telegramTrigger
Config choices
Version 1.3

Block 13 - Send Telegram Notification1

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 14 - Send Telegram Rejection1

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 15 - Build Success File

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 16 - README - Workflow Overview

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 17 - SETUP - Credentials and Required Config

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 18 - USAGE - Upload Options

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 19 - REFERENCE - Output Schema

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 20 - TESTING - Creator Checklist

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

3. Summary Table

Workflow Extract invoice data with Google Gemini, Google Sheets, and Telegram
Complexity advanced
Nodes 20
Categories Invoice Processing, AI Summarization
Author Hồ Đình Huy
Published 25 May 2026

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/15937/15937.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Extract invoice data with Google Gemini, Google Sheets, and Telegram do?

Quick overview This workflow accepts invoice PDFs or images from an n8n Form or Telegram, uses Google Gemini to OCR and extract structured invoice fields and line items, appends the results to Goog...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Invoice Processing, AI Summarization use case.