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 Boonget3 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
- In Telegram, search for
@BotFatherand type/newbot - Name your bot when BotFather asks
- You'll get a Token that looks like
123456:ABC-xyz.... Keep it safe and don't share it - 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:
| Property | Value |
|---|---|
| TG_TOKEN | Your bot token |
| TG_CHAT | Chat ID |
3. Code to send a message
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.
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.
Comments
No comments yet. Be the first to share your thoughts or ask a question.
Read next
Build a Search Page for Your Google Sheets Data with Apps Script in 15 Minutes
Turn a sheet with thousands of rows into a simple web page where anyone on your team can type and find what they need, without opening the sheet.
Stop Putting Secrets in Your Code! Store PINs and Tokens with Script Properties
Form PINs, bot tokens and API keys don't belong in your code. Here's a simple way to store them more safely.