The moment it happens
Log receipts sent to Telegram in Excel
Send a photo or PDF of a receipt to your Telegram bot and the date, supplier and amount are added to your Excel expenses table.
- Runs
- The moment it happens
- Apps
- Microsoft Excel, Telegram
- AI
- Yes, uses the built-in AI allowance
- Access
- Files.ReadWrite; bot token
Send this to your assistant
Create a ClickRuntime automation: when I send a receipt photo or PDF to my Telegram bot, read the date, supplier and total, add it to the Expenses table in my Excel workbook on OneDrive, and reply to confirm.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
Receipts get stuffed in wallets and glove boxes, and expense claims are pieced together at the end of the month from faded paper. Tradespeople and consultants lose money on costs they can't evidence.
Snapping a receipt into a Telegram chat the moment you pay, and having it read and logged in Excel, means every cost is recorded on the day, with no typing and no shoebox at month end.
What you get out of it
Logged the moment you pay
Take a photo at the till and you're done. The receipt can't get lost before it's recorded.
No typing
Date, supplier and total are read from the photo. You only correct the occasional misread.
Duplicates caught
Sending the same receipt twice is spotted and skipped. Your totals stay right.
Ready for your accountant
Everything is in one Excel table. Filter by month and send it on.
How it works
What happens, step by step
You send a receipt photo or PDF to your Telegram bot.
It checks the message came from an allowed person and downloads the file.
AI reads the date, supplier and total from the receipt.
If the same receipt was already logged it's skipped; otherwise a row is added to your Excel table.
The bot replies with what it recorded.
Before it runs live
- Connect Microsoft Excel
- 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 Microsoft Excel and Telegram steps into one automation
Under the hood
The code that runs this automation
GRAPH = "https://graph.microsoft.com/v1.0"
TG = "https://api.telegram.org"
import base64
from clickruntime import on_event, credentials, http, state, ai
ALLOWED = {123456789}
TABLE = "/me/drive/root:/Finance/expenses.xlsx:/workbook/tables/Expenses/rows/add"
SCHEMA = {"type": "object", "properties": {"date": {"type": "string"}, "supplier": {"type": "string"}, "total": {"type": "number"}}, "required": ["date", "supplier", "total"]}
@on_event
def handle(event):
msg = (event.json or {}).get("message", {})
chat = msg.get("chat", {}).get("id")
f = (msg.get("photo") or [None])[-1] or msg.get("document")
if chat not in ALLOWED or not f:
return {"skipped": True}
bot = f"{TG}/bot{credentials.secret('TELEGRAM_BOT_TOKEN')}"
path = http.get(f"{bot}/getFile", params={"file_id": f["file_id"]}).json()["result"]["file_path"]
data = http.get(f"{TG}/file/bot{credentials.secret('TELEGRAM_BOT_TOKEN')}/{path}").content
r = ai.generate(["Read this receipt. Return date (YYYY-MM-DD), supplier and total.", base64.b64encode(data).decode()[:30000]],
json_schema=SCHEMA, max_output_tokens=80).json
key = f"{r['date']}|{r['supplier'].lower()}|{r['total']}"
if state.get(key):
http.post(f"{bot}/sendMessage", json={"chat_id": chat, "text": "Already logged this one."})
return {"duplicate": key}
h = {"Authorization": f"Bearer {credentials.connection('microsoft', 'work')}"}
http.post(f"{GRAPH}{TABLE}", headers=h, json={"values": [[r["date"], r["supplier"], r["total"], str(chat)]]}).raise_for_status()
state.set(key, True)
http.post(f"{bot}/sendMessage", json={"chat_id": chat, "text": f"Logged {r['supplier']} {r['total']:.2f} on {r['date']}"})
return {"logged": key}FAQ
Common questions
Does it work with PDFs as well as photos?
What if it reads the amount wrong?
Can colleagues send receipts too?
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
Get a Telegram message when an Excel sheet changes
You hear on Telegram whenever rows are added, changed or removed in a shared Excel sheet.
See how it worksAdd rows to an Excel table from Telegram messages
Messages sent to your Telegram bot in a set format, such as "12.50 lunch with client", are added as dated rows to an Excel table in OneDrive, and the bot replies to confirm.
See how it worksGet Telegram reminders for due dates in an Excel sheet
Every morning at 8am a Telegram message lists rows in an Excel sheet that are due today or overdue and not marked Done, with the owner and days late.
See how it worksKeep exploring
Set up “Log receipts sent to Telegram in Excel” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.