Automated expense tracking from emails & Telegram with Gemini AI & Google Sheets
Ready for 3.0Ready for 3.0. This template uses no nodes that n8n 3.0 removes. No removed nodes, versions or helpers found. Static check, last run 2026-10-19.
Worth a look
- Gmail Trigger below v1.4 runs as v1.4 (drafts skipped, max emails per poll) (Gmail Trigger)
Nodes used (10)
- Telegram Trigger
n8n-nodes-base.telegramTrigger - Google Gemini Chat Model
@n8n/n8n-nodes-langchain.lmChatGoogleGemini - Basic LLM Chain
@n8n/n8n-nodes-langchain.chainLlm - Structured Output Parser
@n8n/n8n-nodes-langchain.outputParserStructured - Gmail Trigger
n8n-nodes-base.gmailTrigger - If
n8n-nodes-base.if - Google Sheets
n8n-nodes-base.googleSheets - Telegram
n8n-nodes-base.telegram - Code
n8n-nodes-base.code - Information Extractor
@n8n/n8n-nodes-langchain.informationExtractor
What it does
This workflow contains community nodes that are only compatible with the self-hosted version of n8n. This n8n template automatically parses bank transaction emails (HDFC, Indian Bank, Indian Overseas Bank, UPI apps like Google pay, Paytm, etc.) - The from email(bank name/UPI apps) is changable, classifies them using Gemini AI, and logs them into a structured Google Sheets budget tracker. It helps you consolidate expenses, compare against monthly budgets, and get real-time alerts when limits are exceeded. 📝 Problem Statement Tracking expenses manually from different bank emails and UPI apps is frustrating, time-consuming, and error-prone. Small transactions often slip through, making budget control difficult. This workflow solves that by: Automatically extracting financial data from Gmail. Categorizing expenses using AI parsing. Saving all data into Google Sheets in a structured way. Comparing with monthly budgets and raising alerts. Target Audience: Individuals who want personal budget automation. Families managing shared household spending. Small teams looking for a lightweight financial log. ⚙️ Setup Prerequisites An n8n instance (self-hosted or cloud). A Google account with Gmail + Google Sheets enabled. Pre-created Google Sheets file with 2 tabs: Expenses Budgets A configured Gemini API connection in n8n. 📊 Google Sheets Template Expenses Tab (columns in order): Timestamp | Date | Account | From | To | Type | Category | Description | Amount | Currency | Source | MessageId | Status Budget Tab (columns in order): Month | Category | Budget Amount | Notes | UpdatedAt Yearly Summary Tab (auto-calculated): Year | Month | Category | Total Expense | Budget | Variance | Alert Variance = Budget - Total Expense Alert = ⚠️ Over Budget when spending > budget 🚀 How It Works Gmail: Gmail Trigger captures new bank/UPI emails. Gemini AI Parser extracts structured details (date, amount, category, etc.). Filter Node ensures only valid financial transactions are logged. Information extractor will extract the information like Date, account, transaction type(Credit/Debit), description, currency, status, messageId, from email, to email, category -> checks if the transaction is 'Credit' or 'Debit' then appends the details to the respective google sheet Budget Validator checks against monthly allocations. If the expense is above the budget is raises an alert and will send a email to the connected account. For sending email I wrote a Google Sheet App script: function myFunction() { var ss = SpreadsheetApp.getActiveSpreadsheet(); var monthly = ss.getSheetByName("MonthlySummary"); var yearly = ss.getSheetByName("YearlySummary"); // Get values from Monthly Summary var totalExpense = monthly.getRange("D2").getValue(); var budget = monthly.getRange("E2").getValue(); // Get current date info var now = new Date(); var month = Utilities.formatDate(now, "GMT+5:30", "MM"); var year = Utilities.formatDate(now, "GMT+5:30", "yyyy"); var status = (totalExpense > budget) ? "Alert" : ""; // Append to Yearly Summary yearly.appendRow(year, month, totalExpense, status); // If budget exceeded, send alert email if (status === "Alert") { var emailAddress = "YOUR EMAIL"; var subject = "⚠️ Budget Exceeded - " + month + "/" + year; var body = "Your total expenses this month (" + totalExpense + ") have exceeded your budget of " + budget + ".\n\n" + "Please review your spending."; MailApp.sendEmail(emailAddress, subject, body); } // 🔄 Reset Monthly Summary var lastRow = monthly.getLastRow(); if (lastRow > 3) { // assuming headers in first 2-3 rows monthly.getRange("A4:C" + lastRow).clearContent(); } // Reset total in D2 monthly.getRange("D2").setValue(0); } Monthly summary auto-calculates the expense and updates the expense for every month and budgets(sum all budgets if there are more than 1 budgets). Yearly Summary auto-updates and raises over-budget alerts. Telegram: Takes input from a telegram bot which is connected to the n8n workflow telegram trigger. Ge