Stock Alerts with Google Sheets

Last updated: Oct 2025

I use Google Sheets to track the stock market and trigger alerts when prices go above or below certain levels.

Below are the formulas and the script I use to send email notifications.

For regular stock I use =GOOGLEFINANCE(), for crypto I utilize the free crypto price tracker cryptoprices.cc with the formula =IMPORTDATA("https://cryptoprices.cc/DOGE/"). I use formulas in the column B, everything else is just text.

To automate email notification with Apps Script, go to Extensions >Apps Script.

Below is my code that sends me email when my stocks go below or above the treshold that I specified in my sheet.

appsscript.json

{
  "timeZone": "America/Chicago",
  "dependencies": {
  },
  "exceptionLogging": "STACKDRIVER",
  "runtimeVersion": "V8",
  "oauthScopes": [
    "https://www.googleapis.com/auth/spreadsheets",
    "https://www.googleapis.com/auth/script.external_request",
    "https://www.googleapis.com/auth/userinfo.email",
    "https://www.googleapis.com/auth/gmail.send"
]
}

Code.gs

function checkStockAlerts() {
  const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("monitoring");
  const dataRange = sheet.getRange(2, 1, sheet.getLastRow() - 1, 4); // Columns A, B, C, and D starting from row 2
  const data = dataRange.getValues();
  const email = Session.getActiveUser().getEmail(); // Automatically uses your email address
  const alerts = [];
  
  data.forEach((row, index) => {
    const stockTicket = row[0]; // Column A: Stock Ticket
    const currentPrice = row[1]; // Column B: Current Stock Price
    const condition = row[2];   // Column C: above or below
    const triggerLevel = row[3]; // Column D: Trigger Price

    if (condition && triggerLevel && currentPrice) {
      if ((condition.toLowerCase() === "above" && currentPrice > triggerLevel) ||
          (condition.toLowerCase() === "below" && currentPrice < triggerLevel)) {
        alerts.push(`${stockTicket}: ${currentPrice} is ${condition} ${triggerLevel}.`);
      }
    }
  });

  if (alerts.length > 0) {
    const subject = "Stock Alert Notification";
    const body = alerts.join("\n");
    GmailApp.sendEmail(email, subject, body);
  }
}

I find Google Sheets very useful for managing my trades — it helps me stay organized and keep emotions out of decisions. I just set my triggers for when to buy or sell and follow them calmly when the time comes.

In the future, I plan to add some AI features — not to automate trading itself, but to improve how I analyze and get insights. The goal is to stay informed while keeping full control over the final decisions.