Every 5 minutes
Log TradingView alert emails to a Google Sheet
Every TradingView alert email becomes a row in your Signals sheet with the ticker, buy or sell signal and price.
- Runs
- Every 5 minutes
- Apps
- Gmail, Google Sheets
- AI
- Not needed
- Access
- Gmail gmail.readonly; Sheets read+write
Send this to your assistant
Create a ClickRuntime automation: every 5 minutes, check my Gmail for TradingView alert emails, pull out the ticker, action and price, and add them to my Signals sheet.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
A part-time trader runs a dozen alerts that fire by email through the day. The emails pile up in the inbox, and at the end of the week there is no easy way to see which signals fired, when, or whether they were any good.
This automation reads each new alert email, pulls out the ticker, signal and price, and adds a row to a Google Sheet. The inbox stops being the record, and the sheet becomes a history you can sort, chart and review.
What you get out of it
A complete signal history
Every alert is logged with its time and price, so you can look back at what fired and judge how a strategy performed.
Sort and filter like any sheet
Once alerts are rows, you can filter by ticker, count signals per week or add a column for the outcome of each trade.
Nothing is missed in a busy inbox
Alerts that arrive while you are away are still logged, in order, within minutes.
Plain rules, no guesswork
The fields are read from the email text with fixed patterns, so the same email always produces the same row.
How it works
What happens, step by step
Every 5 minutes ClickRuntime checks your Gmail for new emails from TradingView.
It reads the ticker, the buy or sell signal and the price from each alert.
Emails it has already logged are skipped.
Each alert is added as a new row in your Signals sheet with the time it arrived.
Before it runs live
- Connect Google through your own Google app (a one-time, 10-minute setup), so it works with your own Gmail
- Connect your Google Sheets account and pick the spreadsheets it may use
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
- Add an AI step, for example to summarize, sort or draft a reply
- Add another app, for example also send it to Slack
- Combine it with other Gmail and Google Sheets 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_trigger, credentials, state, report_fetched
SHEET_ID = "your-spreadsheet-id"
PATTERN = re.compile(r"\b([A-Z]{1,6})\b.*?\b(buy|sell)\b.*?([0-9]+(?:\.[0-9]+)?)", re.I | re.S)
@on_trigger
def run(event):
creds = Credentials(credentials.connection("google", "work"))
gmail = build("gmail", "v1", credentials=creds, cache_discovery=False)
after = state.get("after") or 0
msgs = gmail.users().messages().list(userId="me", q=f"from:noreply@tradingview.com after:{after}").execute().get("messages", [])
msgs = [gmail.users().messages().get(userId="me", id=m["id"]).execute() for m in msgs]
msgs = [m for m in msgs if int(m["internalDate"]) // 1000 > after]
report_fetched(len(msgs))
if not msgs:
return {"logged": 0}
rows = []
for m in sorted(msgs, key=lambda m: int(m["internalDate"])):
hit = PATTERN.search(m["snippet"])
if hit:
ts = datetime.fromtimestamp(int(m["internalDate"]) / 1000, timezone.utc).isoformat(timespec="minutes")
rows.append([ts, hit.group(1).upper(), hit.group(2).lower(), hit.group(3)])
if rows:
build("sheets", "v4", credentials=creds, cache_discovery=False).spreadsheets().values().append(
spreadsheetId=SHEET_ID, range="Signals!A:D", valueInputOption="USER_ENTERED", body={"values": rows}).execute()
state.set("after", max(int(m["internalDate"]) // 1000 for m in msgs))
return {"logged": len(rows)}FAQ
Common questions
What does the alert message need to contain?
Will an alert be logged twice?
Can I log alerts from other senders?
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
Log PDF invoices from Gmail in a spreadsheet
Every invoice that arrives by email is added as a row in your Invoices sheet with supplier, date, number and total.
See how it worksReply to chosen senders with AI and log every exchange
When someone on your list emails you, they get a prompt reply written by AI, and each email and reply is logged in a Google Sheet.
See how it worksScore new leads in a sheet and email the best ones
Each new lead in your sheet gets a score and a reason, and you get an email with a suggested first message for any strong one.
See how it worksKeep exploring
Set up “Log TradingView alert emails to a Google Sheet” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.