Build a stock tracker in Google Sheets (with an email alert)

A free Google Sheets stock tracker with GOOGLEFINANCE formulas for price, PE and 52-week range, plus a short script that emails you when a price hits your level.

· 7 min read

Google Sheets can pull share prices for free with one function, GOOGLEFINANCE. With a few columns and a short script, you get a tracker that shows price, PE and distance from the high, and emails you when something reaches your level.

Step 1: the columns

Set up a sheet called Tracker with these headers in row 1:

ColumnHeaderWhat goes in it
ATickerExchange and code, e.g. NASDAQ:AAPL or LON:TSCO
BPriceFormula
CPEFormula
D52w highFormula
EOff highFormula
FMy levelThe price you'd act at, typed in
GHit?Formula

Step 2: the formulas

Put these in row 2 and fill down.

B2: =GOOGLEFINANCE(A2, "price")
C2: =GOOGLEFINANCE(A2, "pe")
D2: =GOOGLEFINANCE(A2, "high52")
E2: =1 - B2 / D2
G2: =IF(AND(F2 > 0, B2 <= F2), "YES", "")

Format column E as a percentage and it shows how far each share is below its 52-week high. Column G says YES when the price is at or under your level.

Two things catch people out. Prices can be delayed by up to 20 minutes, so this is a tracker, not a trading screen. And London shares come back in pence: LON:TSCO at 380 means £3.80. If you're adding up a portfolio in pounds, divide London prices by 100. Our pence guide explains why.

Step 3: the email alert

Sheets won't email you on its own. Open Extensions, then Apps Script, delete what's there and paste this:

function checkLevels() {
  const sheet = SpreadsheetApp.getActive().getSheetByName("Tracker");
  const rows = sheet.getRange(2, 1, sheet.getLastRow() - 1, 7).getValues();
  const hits = rows.filter(r => r[0] && r[5] > 0 && r[1] <= r[5]);
  if (!hits.length) return;
  const lines = hits.map(r => r[0] + " is at " + r[1] + " (your level " + r[5] + ")");
  MailApp.sendEmail(Session.getActiveUser().getEmail(), "Price level reached", lines.join("\n"));
}

Save it, run it once to grant permission, then add a trigger: the clock icon, Add Trigger, choose checkLevels, time-driven, day timer, and pick an hour after the market closes.

One flaw to know about: this emails you every day while a price stays below your level, not once. Fixing that means keeping a "sent" column and checking it, which is where most spreadsheet trackers start to grow.

Where the spreadsheet route gets hard

It's a good free tool, and building it teaches you a lot. The limits show up over time:

  • It breaks quietly. GOOGLEFINANCE sometimes returns #N/A for a ticker for a day, and your script either errors or misses a hit.
  • No history of what you set and when. Change a level and the old one is gone.
  • One-shot alerts take extra work. As above.
  • PE needs checking. GOOGLEFINANCE's PE for some London shares can look a hundred times too big because of the pence-and-pounds mix. Sense-check anything that looks odd against our PE ratio guide.

The no-spreadsheet version

If you'd rather not maintain it, Duskbird does the same job: add companies, set a price, a fall from the high, or a PE, and get one email the day it's reached. It also handles crypto and European shares, and can send a daily, weekly or monthly summary with news. It's also worth knowing that Google Finance itself doesn't have simple price alerts.

Questions people ask

How do I get a stock price in Google Sheets?

Use =GOOGLEFINANCE("NASDAQ:AAPL", "price"), replacing the ticker with the exchange and code you want. London shares use the LON: prefix, for example LON:TSCO.

Can GOOGLEFINANCE show the PE ratio?

Yes, with =GOOGLEFINANCE(ticker, "pe"). Other useful attributes include "eps", "high52", "low52" and "changepct".

Is GOOGLEFINANCE real time?

No. Google says quotes may be delayed by up to 20 minutes, so it suits tracking rather than trading.

Can Google Sheets send me an email when a stock hits a price?

Yes, with an Apps Script on a time-driven trigger that checks your levels and calls MailApp.sendEmail. The script in this guide does that.