The moment it happens
Log expenses from Telegram messages to Google Sheets
Type "12.50 lunch" to your bot and a row with the date, amount, category and note is added to your Google Sheet, with this month's total in the reply.
- Runs
- The moment it happens
- Apps
- Google Sheets, Telegram
- AI
- Optional
- Access
- Sheets write (spreadsheets); bot token
Send this to your assistant
Create a ClickRuntime automation: when I send my Telegram bot a message like "12.50 lunch with Sam", add a row to my Expenses Google Sheet with the date, amount, a category and the note, then reply with my total for this month.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
Budget apps ask you to open them, pick a category and tap through a form, so small expenses get skipped and the month's numbers never add up. A Google Sheet is easier to trust but painful to edit on a phone.
This automation makes logging an expense as quick as sending a message. You type the amount and a few words to your bot, a row lands in your Google Sheet, and the reply tells you what you have spent this month so far.
It suits individuals, couples and freelancers who keep their budget in Google Sheets and want to log spending the moment it happens.
What you get out of it
Log in a few seconds
Amount and a word or two is all it takes, from a chat you already have open.
Your data stays in your sheet
Rows go into a normal Google Sheet you can chart, filter and share.
Running total in every reply
You see the month's spending each time you log, which is often enough to change a habit.
Categories without tapping
Keywords sort expenses for you, and anything unusual lands in Other to fix later.
No receipt needed
Works for cash, tips and small buys where there is nothing to photograph.
How it works
What happens, step by step
You send your bot an amount followed by a few words, like "12.50 lunch with Sam" or "60 fuel".
ClickRuntime reads the amount and picks a category from the words, such as Food or Transport.
It adds a row to your Google Sheet with the date, amount, category and note.
The bot replies with the category it chose and your running total for the month.
Before it runs live
- Connect your Google Sheets account and pick the spreadsheets it may use
- Connect Telegram
- Paste your automation's link into the other app's webhook settings
What you get
Build your own
Need it to work differently?
Your own rules
Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.
Any number of apps
One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.
AI where it helps
Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.
On a schedule or on each event
Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.
Changes you can ask for
- Act only on the items that match your own rules, and skip the rest
- Change what the AI looks for, or how it writes the result
- Add another app, for example also send it to Slack
- Combine it with other Google Sheets and Telegram steps into one automation
Under the hood
The code that runs this automation
import re
from datetime import datetime, timezone
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from clickruntime import on_event, credentials, http
SHEET_ID, OWNER = "your-sheet-id", 123456789
CATS = {"Food": ["lunch", "dinner", "coffee", "grocer"], "Transport": ["fuel", "taxi", "uber", "train", "parking"],
"Home": ["rent", "power", "internet"], "Fun": ["cinema", "concert", "game"]}
def tg(method, **params):
r = http.post(f"https://api.telegram.org/bot{credentials.secret('TELEGRAM_BOT_TOKEN')}/{method}", json=params)
r.raise_for_status()
return r.json()["result"]
@on_event
def handle(event):
msg = (event.json or {}).get("message", {})
chat, text = msg.get("chat", {}).get("id"), (msg.get("text") or "").strip()
m = re.match(r"^(\d+(?:[.,]\d{1,2})?)\s+(.+)$", text)
if chat != OWNER or not m:
if chat == OWNER:
tg("sendMessage", chat_id=chat, text="Send an amount then a note, e.g. 12.50 lunch")
return {"skipped": True}
amount, note = float(m[1].replace(",", ".")), m[2]
cat = next((c for c, words in CATS.items() if any(w in note.lower() for w in words)), "Other")
day = datetime.fromtimestamp(msg["date"], timezone.utc).strftime("%Y-%m-%d")
values = build("sheets", "v4", credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False).spreadsheets().values()
values.append(spreadsheetId=SHEET_ID, range="Expenses!A:D", valueInputOption="USER_ENTERED",
body={"values": [[day, amount, cat, note]]}).execute()
rows = values.get(spreadsheetId=SHEET_ID, range="Expenses!A2:B").execute().get("values", [])
total = sum(float(r[1]) for r in rows if len(r) > 1 and r[0][:7] == day[:7])
tg("sendMessage", chat_id=chat, text=f"Added {amount:.2f} · {cat} · {note}\n{datetime.strptime(day, '%Y-%m-%d'):%B} so far: {total:,.2f}")
return {"amount": amount, "category": cat}
FAQ
Common questions
How are categories chosen?
Can I log an expense for a different day?
Can two people log to the same sheet?
What permissions does it need?
Does it need AI?
How many runs does it use?
Can I change how it works?
Related
You might also like
Turn Telegram ideas into short videos logged in a sheet
Message your bot an idea and get back a finished short video, with every video tracked in your Google Sheet.
See how it worksAnswer Telegram questions from a Google Sheet
People message your Telegram bot and get answers drawn from your sheet, with every question and reply logged.
See how it worksTurn receipt photos into rows in your expense sheet
Send a photo of a receipt to your Telegram bot and the merchant, date, total and category land in your expenses sheet.
See how it worksKeep exploring
Set up “Log expenses from Telegram messages to Google Sheets” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.