Automated Expense Tracking from Telegram Messages to Google Sheets - n8n Workflow

Use this powerful n8n workflow to automatically parse bank transaction messages from Telegram using custom code and log all financial details directly into Google Sheets. Perfect for automated budgeting.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Individuals or small businesses tracking personal or operational expenses automatically.
Users who receive bank transaction alerts via Telegram and need a structured database.
Developers seeking advanced n8n templates utilizing custom code and regex for data extraction.
Anyone needing a reliable, low-effort financial logging solution within an n8n workflow.

Overview

This robust n8n workflow addresses the challenge of manually logging financial transactions received as text messages. When banks send transaction notifications via platforms like Telegram, this n8n template captures the message, parses the critical details, and logs them instantly.

The automation begins with the Telegram n8n trigger. The intelligence of this n8n workflow lies in the custom Code n8n node, which is configured with advanced regular expressions (regex) capable of identifying and extracting structured data—such as merchant name, amount, card ending, and available limit—from various proprietary bank notification formats.

By leveraging this core logic, the data is transformed from unstructured text into clean, structured records ready for analysis. The final step uses the Google Sheets n8n node to ensure immediate and accurate financial record-keeping, making this n8n workflow a cornerstone for automated financial management.

How it Works

The process executes in several critical stages, starting with the primary n8n trigger:


  1. Telegram Trigger Activation: The n8n workflow starts immediately upon receiving a new message update via the configured Telegram Trigger n8n node. This acts as the listener for your transaction alerts.

  2. Initial Filtering: The message payload is routed to an If n8n node. This filter performs a basic check (looking for the = character in the text) to quickly confirm if the message is potentially a transaction notification, preventing unnecessary execution of the complex parsing logic.

  3. Data Parsing (Code n8n node): If the message passes the filter, it enters the 'transactions' Code n8n node. This is the heart of the n8n workflow. It uses intricate JavaScript and three distinct regex patterns (format1, format2, format3) to match known bank message styles, extracting key fields like Amount, Merchant, Date, and Time into a standardized JSON object.

  4. Logging to Google Sheets: The final, cleanly structured output from the custom Code n8n node is directed to the Google Sheets n8n node. This n8n node appends the comprehensive expense record (including date, time, and limit details) to the specified spreadsheet, completing the automated expense tracking process.

Installation Guide

To deploy this powerful n8n workflow, follow these setup steps:


  1. Import: Import the provided n8n workflow JSON into your n8n instance using the 'New' button > 'Import from JSON'.

  2. Telegram Trigger Setup: Configure your Telegram API credentials. The Telegram Trigger n8n node requires setting up a Telegram Bot and linking its webhook URL to your running n8n instance. This enables the n8n trigger to receive messages.

  3. Google Sheets Credential Setup: Create a Google Sheets OAuth2 API credential. Ensure this credential has the necessary read/write scope to interact with your spreadsheet.

  4. Google Sheets Node Configuration: In the Google Sheets n8n node, update the Document ID and Sheet Name parameters to match your target expense ledger. Ensure your sheet columns match the fields being passed: Date, Time, Amount, Merchant, Card Ending, and Available Limit.

  5. Custom Code Review: If your bank's message format differs from those defined in the transactions Code n8n node, you must modify the regex patterns (format1, format2, format3) within the JavaScript to successfully parse your specific transaction messages. This customization is key to the success of this n8n template.

Node Details

Telegram Trigger (n8n node): Serves as the primary starting point, the n8n trigger. It listens for incoming messages, initiating the n8n workflow.
If (n8n node): A flow control node that acts as a guardrail. It checks if the incoming message text contains the = sign, ensuring only likely transaction messages proceed to the resource-intensive parsing step.
transactions (Code n8n node): The core intelligence of this n8n workflow. It uses customized JavaScript and regular expressions to parse unstructured Telegram text messages, normalizing data from three different potential formats into consistent output variables (e.g., Amount, Merchant, Date).
Google Sheets (n8n node): The final action node. Configured to append data, it maps the extracted fields from the Code n8n node directly into columns in your chosen Google Sheet document, providing real-time expense logging.

Related n8n Workflows

Free

Nodes: 5 Nodes
Updated: December 26 2025
View all
Created by
Mujtaba
Mujtaba

A digital/performance marketing professional who builds smart automation workflows using n8n. I help simplify complex tasks, improve efficiency, and save time by connecting apps and automating processes. I’m passionate about no-code solutions that drive business growth.

Featured*