Telegram to Google Sheets, receipts logged instantly
Receipts don’t fail because you don’t care. They fail because they live in five places: your camera roll, WhatsApp, email, a crumpled pocket copy, and “I’ll do it later.” Then month-end hits and you’re guessing.
If you’re a business owner trying to keep spend clean, a marketer juggling card charges across tools, or a freelancer who just wants tax season to be painless, Telegram receipt logging automation fixes the annoying part. You send a receipt. It becomes a tidy row in Sheets. Done.
This guide shows what the workflow does, the results you can expect, and what you’ll need before you switch it on in n8n.
How This Automation Works
Here’s the complete workflow you’ll be setting up:
n8n Workflow Template: Telegram to Google Sheets, receipts logged instantly
flowchart LR
subgraph sg0["Telegram Flow"]
direction LR
n0["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/telegram.svg' width='40' height='40' /></div><br/>Telegram Trigger"]
n1@{ icon: "mdi:cog", form: "rounded", label: "Aggregate1", pos: "b", h: 48 }
n2@{ icon: "mdi:cog", form: "rounded", label: "Extract from File", pos: "b", h: 48 }
n3@{ icon: "mdi:robot", form: "rounded", label: "AI Agent", pos: "b", h: 48 }
n4@{ icon: "mdi:brain", form: "rounded", label: "Google Gemini Chat Model", pos: "b", h: 48 }
n5@{ icon: "mdi:memory", form: "rounded", label: "Simple Memory", pos: "b", h: 48 }
n6@{ icon: "mdi:robot", form: "rounded", label: "Structured Output Parser", pos: "b", h: 48 }
n7@{ icon: "mdi:wrench", form: "rounded", label: "Calculator", pos: "b", h: 48 }
n8@{ icon: "mdi:swap-horizontal", form: "rounded", label: "Switch", pos: "b", h: 48 }
n9["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/telegram.svg' width='40' height='40' /></div><br/>Get a file1"]
n10["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/telegram.svg' width='40' height='40' /></div><br/>Get a file2"]
n11@{ icon: "mdi:database", form: "rounded", label: "Append row in sheet", pos: "b", h: 48 }
n12["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/telegram.svg' width='40' height='40' /></div><br/>Send a text message"]
n13["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>Code in JavaScript"]
n14@{ icon: "mdi:database", form: "rounded", label: "Get row(s) in sheet in Googl..", pos: "b", h: 48 }
n15@{ icon: "mdi:cog", form: "rounded", label: "Upload file", pos: "b", h: 48 }
n16@{ icon: "mdi:cog", form: "rounded", label: "Upload file1", pos: "b", h: 48 }
n17["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/merge.svg' width='40' height='40' /></div><br/>Merge1"]
n18@{ icon: "mdi:robot", form: "rounded", label: "Analyze an image", pos: "b", h: 48 }
n19["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/merge.svg' width='40' height='40' /></div><br/>Merge"]
n20@{ icon: "mdi:swap-horizontal", form: "rounded", label: "If", pos: "b", h: 48 }
n21@{ icon: "mdi:robot", form: "rounded", label: "AI Agent1", pos: "b", h: 48 }
n22@{ icon: "mdi:memory", form: "rounded", label: "Simple Memory1", pos: "b", h: 48 }
n23@{ icon: "mdi:wrench", form: "rounded", label: "Calculator1", pos: "b", h: 48 }
n24["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/telegram.svg' width='40' height='40' /></div><br/>Send a text message1"]
n25@{ icon: "mdi:database", form: "rounded", label: "Get row(s) in sheet in Googl..", pos: "b", h: 48 }
n26@{ icon: "mdi:brain", form: "rounded", label: "Google Gemini Chat Model1", pos: "b", h: 48 }
n20 --> n1
n19 --> n20
n17 --> n20
n8 --> n9
n8 --> n10
n8 --> n21
n3 --> n11
n21 --> n24
n1 --> n3
n7 -.-> n3
n23 -.-> n21
n9 --> n13
n10 --> n16
n10 --> n2
n15 --> n19
n16 --> n17
n5 -.-> n3
n22 -.-> n21
n18 --> n19
n0 --> n8
n2 --> n17
n13 --> n15
n13 --> n18
n11 --> n12
n4 -.-> n3
n6 -.-> n3
n26 -.-> n21
n14 -.-> n3
n25 -.-> n21
end
%% Styling
classDef trigger fill:#e8f5e9,stroke:#388e3c,stroke-width:2px
classDef ai fill:#e3f2fd,stroke:#1976d2,stroke-width:2px
classDef aiModel fill:#e8eaf6,stroke:#3f51b5,stroke-width:2px
classDef decision fill:#fff8e1,stroke:#f9a825,stroke-width:2px
classDef database fill:#fce4ec,stroke:#c2185b,stroke-width:2px
classDef api fill:#fff3e0,stroke:#e65100,stroke-width:2px
classDef code fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px
classDef disabled stroke-dasharray: 5 5,opacity: 0.5
class n0 trigger
class n3,n6,n18,n21 ai
class n4,n26 aiModel
class n7,n23 ai
class n5,n22 ai
class n8,n20 decision
class n11,n14,n25 database
class n13 code
classDef customIcon fill:none,stroke:none
class n0,n9,n10,n12,n13,n17,n19,n24 customIcon
Why This Matters: Receipt Tracking Breaks First
Expense tracking usually starts with good intentions and ends with a messy spreadsheet. You buy something, tell yourself you’ll log it later, and the receipt disappears into your phone. When you finally do sit down, the “quick update” becomes a slow hunt for dates, amounts, vendors, and categories. Worse, manual entry invites small errors that create big confusion. One duplicated charge or a missing receipt is all it takes to ruin your confidence in the numbers, which makes budgeting and cash decisions feel like guesswork.
It adds up fast. Here’s where it breaks down in real life.
- You spend about 10 minutes per receipt finding it, reading it, and typing it into a sheet.
- Photos and PDFs don’t copy cleanly, so amounts get mistyped and categories drift over time.
- Receipts live outside your accounting trail, which means you can’t quickly prove a purchase later.
- Even when you do log everything, you still can’t easily answer questions like “food last month vs this month” without extra work.
What You’ll Build: A Telegram Bot That Logs Receipts for You
This workflow turns Telegram into your intake inbox for expenses. You message your bot with a receipt photo, a PDF, or even plain text like “Nov 10 – 2500 NGN – Uber.” n8n detects what you sent, grabs the file from Telegram, and uploads it to your Google Drive (so you always have the original on record). If it’s an image, it runs OCR and extraction with a Gemini Vision model. If it’s a PDF, it pulls the document text. Then an AI agent turns that raw text into clean, structured fields like date, amount, description, and category, and appends a new row into Google Sheets. Finally, you get a friendly confirmation back in Telegram, so you know it’s logged.
The workflow also includes a second “query” path. When you type a question instead of sending a receipt, an AI agent reads your live Google Sheet, uses a calculator tool for totals, and replies with real answers right inside Telegram.
What You’re Building
| What Gets Automated | What You’ll Achieve |
|---|---|
|
|
Expected Results
Say you collect about 20 receipts a week. Manually, at roughly 10 minutes each, that’s about 3 hours of tiny tasks that you’ll probably push to Friday night. With this workflow, logging is basically the time it takes to forward a photo or PDF in Telegram (call it a minute), plus a short processing wait while OCR and the AI agent run. You get those 3 hours back, and your Sheet stays current instead of “eventually updated.”
Before You Start
- n8n instance (try n8n Cloud free)
- Self-hosting option if you prefer (Hostinger works well)
- Telegram for sending receipts to your bot
- Google Sheets to store your expense rows
- Google Drive for saving receipt files
- Gemini API key (get it from Google Cloud Console)
Skill level: Intermediate. You’ll be copying IDs, connecting OAuth credentials, and testing a few message types in Telegram.
Want someone to build this for you? Talk to an automation expert (free 15-minute consultation).
Step by Step
A Telegram message triggers everything. The workflow starts when your Telegram bot receives a photo, a document (like a PDF), or a plain text message.
Message type routing decides the path. A Switch node checks what came in and sends it to image handling, PDF handling, or the “ask a question” finance agent.
Receipts get stored and interpreted. For photos and PDFs, the file is downloaded from Telegram, uploaded to Google Drive, then converted into usable text (Gemini Vision for images, PDF extraction for documents). That text is merged with the Drive link and passed to the receipt-processing AI agent.
Clean rows land in Google Sheets (and you get a reply). The AI agent outputs structured fields like date, amount, description, and category, then n8n appends them to your Sheet and confirms in Telegram. For questions, the query agent reads the Sheet via a tool node and sends an answer back in chat.
You can easily modify the categories and the destination sheet to match how you track spend. See the full implementation guide below for customization options.
Step-by-Step Implementation Guide
Step 1: Configure the Telegram Trigger
Set up the Telegram listener that starts the workflow whenever a new message arrives.
- Add the Telegram Incoming Trigger node and set Updates to
message. - Credential Required: Connect your telegramApi credentials in Telegram Incoming Trigger.
- Save the workflow so n8n registers the Telegram webhook.
Step 2: Route Messages by Type
Route incoming messages into image, document, or text query paths.
- In Route by Message Type, confirm the first rule checks image presence with
{{ $json.message.photo[0].height }}. - Confirm the second rule checks document presence with
{{ $json.message.document.mime_type }}. - Ensure output 1 connects to Fetch Image File, output 2 to Retrieve Document File, and output 3 to Finance Query Agent.
Step 3: Configure Image and Document Intake (Parallel Branches)
Handle image and PDF receipts, store files in Drive, and extract content for OCR.
- In Fetch Image File, set File ID to
{{ $json.message.photo[0].file_id }}and Resource tofile. Credential Required: Connect your telegramApi credentials. - In Transform Binary Script, keep the default JavaScript that maps binary data to
base64Image. - Transform Binary Script outputs to both Drive Upload Image and Gemini Image Analysis in parallel.
- In Drive Upload Image, set Name to
{{ $json.result.file_unique_id }}and choose your Drive Folder ID (replace[YOUR_ID]). Credential Required: Connect your googleDriveOAuth2Api credentials. - In Gemini Image Analysis, set Resource to
image, Input Type tobinary, and Operation toanalyze. Credential Required: Connect your googlePalmApi credentials. - In Retrieve Document File, set File ID to
{{ $json.message.document.file_id }}and Resource tofile. Credential Required: Connect your telegramApi credentials. - Retrieve Document File outputs to both Drive Upload Document and Extract PDF Content in parallel.
- In Drive Upload Document, set Name to
{{ $('Retrieve Document File').item.json.result.file_id }}and select the destination folder (replace[YOUR_ID]). Credential Required: Connect your googleDriveOAuth2Api credentials. - In Extract PDF Content, set Operation to
pdf. - Connect Drive Upload Image and Gemini Image Analysis into Combine Image Streams; connect Drive Upload Document and Extract PDF Content into Combine Document Streams.
[YOUR_ID] placeholders. Replace them with your real Google Drive folder and Sheet IDs.Step 4: Build the Receipt Processing Pipeline
Validate combined inputs, aggregate data, and use the AI agent to extract receipt details.
- From Combine Image Streams and Combine Document Streams, connect to Validate Combined Input, then to Aggregate Receipt Data.
- In Aggregate Receipt Data, set Aggregate to
aggregateAllItemData. - In Receipt Processing Agent, set Text to
{{ $json.data }}, and keep Prompt Type asdefine. - Connect Gemini Chat Model as the language model for Receipt Processing Agent. Credential Required: Connect your googlePalmApi credentials in Gemini Chat Model.
- Connect Conversation Memory and Structured Output Formatter as AI sub-nodes for Receipt Processing Agent. Add credentials to Gemini Chat Model (parent), not these sub-nodes.
- Connect Math Utility and Fetch Sheet Records as tools for Receipt Processing Agent. Credential Required: Connect your googleSheetsOAuth2Api credentials in Fetch Sheet Records.
Step 5: Configure Receipt Storage and Telegram Reply
Store extracted receipt data in Google Sheets and confirm back to the user in Telegram.
- In Append Expense Row, set Operation to
append, select your Document ID ([YOUR_ID]) and Sheet NameSheet1. - Map columns: Date to
{{ $json.output.data.date }}, Category to{{ $json.output.data.category }}, Discription to{{ $json.output.data.description }}, Amount in Naira to{{ $json.output.data.amount }}, and google drive image to{{ $('Aggregate Receipt Data').item.json.data[1].webViewLink }}. - Credential Required: Connect your googleSheetsOAuth2Api credentials in Append Expense Row.
- In Send Telegram Reply, set Text to
{{ $('Receipt Processing Agent').item.json.output.message }}and Chat ID to{{ $('Telegram Incoming Trigger').item.json.message.chat.id }}. - Credential Required: Connect your telegramApi credentials in Send Telegram Reply.
Step 6: Set Up the Finance Query Assistant Path
Respond to text-based finance questions using a separate AI agent and tools.
- In Finance Query Agent, set Text to
{{ $json.message.text }}and keep Prompt Type asdefine. - Connect Secondary Gemini Model as the language model for Finance Query Agent. Credential Required: Connect your googlePalmApi credentials in Secondary Gemini Model.
- Connect Conversation Memory 2, Math Utility 2, and Fetch Sheet Records 2 as AI sub-nodes/tools for Finance Query Agent. Add credentials to Fetch Sheet Records 2 (parent is the node itself): Credential Required: googleSheetsOAuth2Api.
- In Send Query Response, set Text to
{{ $json.output }}and Chat ID to{{ $('Telegram Incoming Trigger').item.json.message.chat.id }}. Credential Required: Connect your telegramApi credentials.
Step 7: Test and Activate Your Workflow
Validate both receipt processing and finance query paths before turning the workflow on.
- Click Execute Workflow and send an image receipt to your Telegram bot to test the receipt path.
- Verify a new row appears in Google Sheets and you receive a confirmation from Send Telegram Reply.
- Send a text question like “How much did I spend on food last month?” and confirm Send Query Response replies.
- When everything works, toggle the workflow to Active to enable production use.
Troubleshooting Tips
- Google Drive or Google Sheets credentials can expire or need specific permissions. If things break, check the credential status in n8n → Credentials first.
- If you’re using Wait nodes or external rendering, processing times vary. Bump up the wait duration if downstream nodes fail on empty responses.
- Gemini prompts and extract rules start generic. Add your category list and example receipts early, or you’ll be correcting “Other stuffs” forever.
Quick Answers
About 30 minutes if your Google and Telegram accounts are ready.
No. You will mostly connect credentials and paste in a Sheet ID and a Drive folder ID.
Yes. n8n has a free self-hosted option and a free trial on n8n Cloud. Cloud plans start at $20/month for higher volume. You’ll also need to factor in Gemini API usage costs, which depend on how many receipts you process.
Two options: n8n Cloud (managed, easiest setup) or self-hosting on a VPS. For self-hosting, Hostinger VPS is affordable and handles n8n well. Self-hosting gives you unlimited executions but requires basic server management.
Yes, and you probably should. You can adjust the category list in the Receipt Processing Agent prompt, swap the destination spreadsheet in the Append Expense Row node, and change the Drive folder used by the Drive Upload Image/Document nodes. If you prefer a different AI provider later, the Gemini Chat Model nodes are the main pieces you would replace while keeping the Telegram and Google steps the same.
Most of the time it’s a bad bot token or the wrong Telegram credential selected in one of the Telegram nodes. Regenerate the token in BotFather, update it in n8n Credentials, then confirm every Telegram node (trigger, file fetch, replies) points to that same credential. If it fails only on downloads, the bot may not have access to the chat where you’re sending receipts, so test in a direct message first. Also check execution logs; Telegram errors are usually explicit, honestly.
Self-hosted n8n has no fixed execution cap, so it mostly depends on your server and your AI API limits. On n8n Cloud, your monthly executions depend on plan tier, and receipt processing can use more than one execution per receipt because it downloads, uploads, extracts, and logs. Practically, most small teams run dozens of receipts a day without issues, then scale up once they’re confident the extraction is stable.
Sometimes, yes. This workflow has branching (photo vs PDF vs question), file handling into Drive, structured AI output, and a live “ask the sheet” agent, which is the kind of logic that gets awkward or expensive in Zapier-style task pricing. n8n also gives you the self-host option, which matters if you want predictable costs and more privacy. If you only need “Telegram message → create one row,” Zapier or Make can be quicker to set up. For anything involving OCR, categorization, and answering spend questions, n8n is usually the smoother long-term choice. If you want a second opinion before you commit, Talk to an automation expert.
Once this is running, receipts stop being a weekend chore and start being background admin. Your sheet stays clean, your files are organized in Drive, and the workflow answers spend questions whenever you ask.
Need Help Setting This Up?
Our automation experts can build and customize this workflow for your specific needs. Free 15-minute consultation—no commitment required.