Telegram to Google Sheets, expenses logged clean
You jot an expense in a chat, promise you’ll “log it later,” and then… it vanishes. Or it lands in a spreadsheet with a weird format, the wrong date, and a note like “coffee??” that means nothing a week later.
Freelancers feel this when reimbursements pile up. A small business owner sees it at month-end. And marketing leads who run lean budgets still need Telegram expense logging that doesn’t turn into another admin chore.
This n8n workflow turns a simple Telegram message into a clean Google Sheets row using GPT-4.1 Mini, so you get a ledger you can actually trust. You’ll see how it works, what you need, and where people usually get stuck.
How This Automation Works
The full n8n workflow, from trigger to final output:
n8n Workflow Template: Telegram to Google Sheets, expenses logged clean
flowchart LR
subgraph sg0["Telegram Intake 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 Intake Trigger"]
n1@{ icon: "mdi:swap-horizontal", form: "rounded", label: "Validate Text Message", pos: "b", h: 48 }
n2@{ icon: "mdi:robot", form: "rounded", label: "Finance Chat Agent", pos: "b", h: 48 }
n3@{ icon: "mdi:brain", form: "rounded", label: "OpenAI Chat Engine", pos: "b", h: 48 }
n4@{ icon: "mdi:robot", form: "rounded", label: "Structured JSON Parser", pos: "b", h: 48 }
n5@{ icon: "mdi:swap-horizontal", form: "rounded", label: "Relevant Expense Check", pos: "b", h: 48 }
n6["<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 Expense Confirmation"]
n7["<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/>Map Expense Fields"]
n8@{ icon: "mdi:database", form: "rounded", label: "Append to Expense Sheet", 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/>Send Unsupported Notice"]
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/>Handle Non-Text Message"]
n1 --> n2
n1 --> n10
n0 --> n1
n3 -.-> n2
n5 --> n6
n5 --> n7
n5 --> n9
n4 -.-> n2
n2 --> n5
n7 --> n8
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 n2,n4 ai
class n3 aiModel
class n1,n5 decision
class n8 database
class n7 code
classDef customIcon fill:none,stroke:none
class n0,n6,n7,n9,n10 customIcon
The Problem: Expense logging breaks when you’re busy
Tracking expenses sounds simple until it’s Tuesday afternoon, you’re in transit, and you’ve already had three “small” purchases that need to be remembered later. Receipts end up in pockets, in email, in a camera roll, and in Slack DMs to yourself. Then you sit down to reconcile everything and realize half the details are missing (was that parking cash or card, and what day was it?). The result is a messy sheet, delayed reimbursements, and a nagging sense you’re undercounting spend.
It adds up fast. The friction compounds in a few predictable places.
- Manual logging steals about 10 minutes per day, which turns into a couple hours by the end of the month.
- Everyone writes expenses differently, so your sheet becomes impossible to filter or summarize cleanly.
- Non-text inputs (photos, PDFs, random forwards) derail the habit, and then the whole system collapses.
- You spend extra time second-guessing categories and dates, honestly the worst kind of admin work.
The Solution: Log expenses in Telegram, save structured rows to Sheets
This workflow gives you a lightweight way to capture spending the moment it happens. You send a normal text message to your Telegram bot, like “Bought coffee for 50k at Highlands,” and n8n takes it from there. First it validates that the incoming message is text (so you don’t accidentally feed the AI a sticker or a file). Then GPT-4.1 Mini reads your message and returns structured fields like date, amount, currency, category, and description, plus a friendly confirmation message. If the message is relevant and usable, the workflow replies in Telegram and appends a new row to your Google Sheet. If it’s not usable, you get a helpful fallback instead of silent failure.
The workflow starts with a Telegram intake trigger. From there, an AI agent extracts consistent JSON, and a structured parser keeps it safe and predictable. Finally, a small code step maps fields into the exact Google Sheets columns you set up, so every entry lands cleanly.
What You Get: Automation vs. Results
| What This Workflow Automates | Results You’ll Get |
|---|---|
|
|
Example: What This Looks Like
Say you log 6 expenses per week. Manually, even a “quick” spreadsheet entry takes about 3 minutes once you find the sheet, pick a category, and type a description, so that’s roughly 20 minutes weekly and about 90 minutes a month. With this workflow, sending a Telegram message is maybe 20 seconds per expense, so you’re closer to 2 minutes per week total, while the AI and Sheets update runs in the background. That’s over an hour back each month, plus cleaner data.
What You’ll Need
- n8n instance (try n8n Cloud free)
- Self-hosting option if you prefer (Hostinger works well)
- Telegram to receive expense messages via a bot
- Google Sheets to store a clean expense ledger
- OpenAI API key (get it from your OpenAI dashboard)
Skill level: Intermediate. You’ll connect accounts, add a sheet, and adjust a prompt, but you won’t be writing an app.
Don’t want to set this up yourself? Talk to an automation expert (free 15-minute consultation).
How It Works
A Telegram message triggers the workflow. When you send your expense text to the bot, n8n receives it instantly and prepares the message content for validation.
Text-only validation keeps inputs reliable. If you send a photo, file, or anything that isn’t plain text, the workflow routes you to a friendly “unsupported” response so the automation doesn’t break.
AI turns your sentence into structured fields. The Finance Chat Agent uses the OpenAI chat model (GPT-4.1 Mini) to extract the key details and return JSON, which is then parsed using a structured output parser for consistency.
Relevant expenses get saved and confirmed. If the AI marks the message as relevant, n8n sends you a confirmation in Telegram, maps fields with a small code step, and appends a new row to your Google Sheet.
You can easily modify the category list to match your chart of accounts based on your needs. See the full implementation guide below for customization options.
Step-by-Step Implementation Guide
Step 1: Configure the Telegram Trigger
Set up the Telegram webhook intake so incoming messages are captured and routed for validation.
- Add and configure Telegram Intake Trigger with Updates set to
messageand Additional Fields → Download enabled. - Credential Required: Connect your
telegramApicredentials to Telegram Intake Trigger. - Connect Telegram Intake Trigger to Validate Text Message to begin message filtering.
Step 2: Validate Incoming Text Messages
Filter out non-text messages before sending content to the AI agent.
- In Validate Text Message, set the condition to check whether Left Value
={{ $json.message.toJsonString() }}containstext. - Ensure the true output connects to Finance Chat Agent and the false output connects to Handle Non-Text Message.
Step 3: Set Up AI Parsing with Finance Chat Agent
Use the agent to extract structured expense data and classify relevance.
- In Finance Chat Agent, set Text to
={{ $json.message.text }}and keep Prompt Type set todefine. - Confirm the System Message is the provided Budget Buddy instruction block for expense extraction and response formatting.
- Ensure OpenAI Chat Engine is connected as the language model for Finance Chat Agent. Credential Required: Connect your
openAiApicredentials to OpenAI Chat Engine. - Confirm Structured JSON Parser is connected as the output parser for Finance Chat Agent, with JSON Schema Example set to the provided expense JSON. Credentials for parsers are added on the parent node (the agent), not the parser.
Step 4: Route Relevant vs. Unsupported Expenses
Split the AI output based on whether the message represents a valid expense.
- In Relevant Expense Check, set the boolean condition with Left Value
={{ $json.output.relevant }}and operatortrue. - Connect the true output to both Send Expense Confirmation and Map Expense Fields in parallel.
- Connect the false output to Send Unsupported Notice.
Step 5: Configure Telegram Responses
Send confirmations for valid expenses or guidance when unsupported content arrives.
- In Send Expense Confirmation, set Text to
={{ $json.output.message }}and Chat ID to={{ $('Telegram Intake Trigger').item.json.message.chat.id }}. - Credential Required: Connect your
telegramApicredentials to Send Expense Confirmation. - In Send Unsupported Notice, set Text to
={{ $json.output.message }}and Chat ID to={{ $('Telegram Intake Trigger').item.json.message.chat.id }}. - Credential Required: Connect your
telegramApicredentials to Send Unsupported Notice. - In Handle Non-Text Message, set Text to
=Sorry, I can’t read files or images right now. Just send me a message describing what you spent, and I’ll help you track it! 💬💸and Chat ID to={{ $('Telegram Intake Trigger').item.json.message.chat.id }}. - Credential Required: Connect your
telegramApicredentials to Handle Non-Text Message.
Step 6: Map Fields and Append to Google Sheets
Transform the structured AI output into rows and append them to your expense tracker.
- In Map Expense Fields, keep the JavaScript Code that maps
Date,Amount,Currency,Category,Description,MessageID, andChatIDfrom the AI output and trigger payload. - Connect Map Expense Fields to Append to Expense Sheet.
- In Append to Expense Sheet, set Operation to
append, Document to[YOUR_ID], and Sheet to[YOUR_ID](cached name:Expense Tracking→Sheet1). - Credential Required: Connect your
googleSheetsOAuth2Apicredentials to Append to Expense Sheet.
Date, Amount, Currency), the append may fail or create empty cells.Step 7: Test and Activate Your Workflow
Run a manual test to confirm Telegram intake, AI extraction, and Google Sheets logging.
- Click Execute Workflow and send a test message to your Telegram bot like
Lunch 120000 VND at Phở Hòa. - Verify that Send Expense Confirmation replies with a friendly confirmation and that Append to Expense Sheet appends a new row.
- Send a non-expense message or image to confirm that Send Unsupported Notice or Handle Non-Text Message responds correctly.
- When testing is successful, toggle the workflow to Active for production use.
Common Gotchas
- Telegram credentials can expire or be mis-pasted. If things break, check the bot token in the Telegram Trigger node and confirm the bot still responds in Telegram.
- If you’re using Wait nodes or external rendering, processing times vary. Bump up the wait duration if downstream nodes fail on empty responses.
- Default prompts in AI nodes are generic. Add your brand voice early or you’ll be editing outputs forever.
Frequently Asked Questions
About 30 minutes if your bot, sheet, and API key are ready.
No. You’ll connect accounts and paste in credentials, then tweak a prompt and map fields.
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 OpenAI API usage costs, which are usually small for short messages.
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, but you’ll want to add a column for Telegram username or chat ID, then include it in the mapped fields before the Google Sheets append. Common tweaks include a stricter category list, multi-currency extraction, and separate sheets per person based on chat ID.
Usually it’s the bot token. Re-check the token in your Telegram Trigger node, confirm the bot is still active in BotFather, and make sure you’re messaging the correct bot account. If the trigger works but replies fail, review permissions and any rate limiting if many people are testing at once.
A lot. On n8n Cloud, capacity is tied to your plan’s monthly executions, and each message is typically one execution. If you self-host, there’s no fixed execution limit; it mainly depends on your server and OpenAI rate limits.
Often, yes. n8n is more forgiving when you need branching logic (text vs non-text, relevant vs not relevant) and it’s easier to self-host when volume grows. The structured output parser approach is also a big deal because it reduces random formatting errors from AI. Zapier or Make can be faster for a very simple two-step flow, but this one benefits from “real” logic and validation. Talk to an automation expert if you want a quick recommendation based on your volume and setup tolerance.
Once this is running, expense capture becomes a quick message, not a weekly chore. The workflow handles the boring parts so your sheet stays clean without you babysitting it.
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.