🇹🇭 อ่านฉบับภาษาไทย →

Send Automatic Telegram Alerts When a New Row Is Added in Google Sheets

Whenever someone submits a form or adds a new job to your sheet, get a Telegram notification right away instead of checking the sheet yourself.

Kumron BoongetKumron Boonget
3 Dec 2026 · 1 min read

A lot of work starts with a new row in a sheet: a customer request, a repair job, or a form filled in by staff. In this article, we'll make Telegram send you an alert every time a new row appears, using Apps Script.

1. Create a Telegram bot

  1. In Telegram, search for @BotFather and type /newbot
  2. Name your bot when BotFather asks
  3. You'll get a Token that looks like 123456:ABC-xyz.... Keep it safe and don't share it
  4. Send your bot one message first (or add the bot to a group), then find the Chat ID of that chat

2. Store the token in Script Properties

Don't write the token directly in your code. Go to Project Settings (gear icon) → Script Properties and add:

PropertyValue
TG_TOKENYour bot token
TG_CHATChat ID

3. Code to send a message

js
function sendTelegram(text) {
  const p = PropertiesService.getScriptProperties();
  const url = 'https://api.telegram.org/bot' + p.getProperty('TG_TOKEN') + '/sendMessage';
  UrlFetchApp.fetch(url, {
    method: 'post',
    payload: { chat_id: p.getProperty('TG_CHAT'), text: text }
  });
}

Try running sendTelegram('Test'). The first time, Google asks for permission. Accept it, and the message should arrive in Telegram right away.

4. Check for new rows every 5 minutes

We remember which row we last sent an alert for, then send only the rows added since.

js
function checkNewRows() {
  const sh = SpreadsheetApp.getActive().getSheetByName('Requests');
  const props = PropertiesService.getScriptProperties();
  const done = Number(props.getProperty('LAST_ROW') || 1);
  const last = sh.getLastRow();
  if (last <= done) return;

  const rows = sh.getRange(done + 1, 1, last - done, 3).getDisplayValues();
  rows.forEach(r => sendTelegram('New job: ' + r[0] + ' / ' + r[1] + ' / ' + r[2]));
  props.setProperty('LAST_ROW', String(last));
}

5. Run it automatically

Go to Triggers (clock icon) → Add Trigger

  • Function: checkNewRows
  • Event source: Time-driven
  • Type: Minutes timer → Every 5 minutes

Note Why not use onEdit? A simple onEdit trigger can't send data outside Google (UrlFetchApp), and it doesn't run when rows are added by a form or another script. Checking on a timer is more reliable.

That's it. Whenever a new row is added, Telegram will let you know within 5 minutes.

#Apps Script#Telegram#Trigger
Kumron Boonget
Kumron Boonget

Operations professional at a container and ISO tank depot in Thailand. He builds the systems his team uses every day with Google Sheets, Apps Script and AppSheet, from search pages to repair tracking and automatic alerts, and shares how to build them in plain language for non-programmers.

Comments

No comments yet. Be the first to share your thoughts or ask a question.

Leave a comment
Comments are reviewed before they appear.

Read next