Sending Telegram messages when a Google Sheets row is updated is simple. You can automate this process with a few steps.
Automation saves time and reduces errors. Connecting Google Sheets with Telegram is a great way to stay updated. Imagine getting instant alerts when your data changes. This can be useful for tracking sales, inventory, or any other data. In this post, you will learn how to set up this automation.
We will guide you through the steps needed. No advanced coding skills required. Just follow along, and you will have your system running in no time. Let’s start and make your workflow smarter!

Credit: digitalinspiration.com
Prerequisites
Before diving into the process of sending Telegram messages when a Google Sheets row is updated, it’s important to ensure you have all the necessary tools and accounts in place. These prerequisites will streamline the setup process and prevent any hiccups along the way.
Tools And Accounts Needed
To automate the process of sending Telegram messages from Google Sheets, you need the following tools and accounts:
- Google Account: Ensure you have an active Google account to access Google Sheets.
- Google Sheets: Create or have an existing Google Sheets file you want to monitor.
- Telegram Account: Sign up for a Telegram account if you don’t have one.
- BotFather: Use BotFather on Telegram to create a new bot and get the API token.
- Google Apps Script: Familiarize yourself with Google Apps Script to write and deploy the necessary code.
Follow these steps to set up Google Sheets for sending Telegram messages:
- Create a new Google Sheet or open an existing one.
- Label columns: Name the columns you want to monitor. For example, “Name”, “Status”, “Comments”.
- Fill in sample data: Enter some test data in the rows to simulate updates.
- Access Google Apps Script: Click on Extensions > Apps Script.
- Write the script: Input the necessary code to monitor changes and send messages. Here’s a simple template:
function sendTelegramMessage() {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var range = sheet.getRange('A1:C1'); // Adjust to your range
var values = range.getValues();
var message = "Row Updated: " + values;
var telegramUrl = "https://api.telegram.org/bot/sendMessage?chat_id=&text=" + encodeURIComponent(message);
UrlFetchApp.fetch(telegramUrl);
}
function onEdit(e) {
sendTelegramMessage();
}
Deploy the script: Save the script and set up a trigger to run onEdit function when changes occur.
Creating A Telegram Bot
Creating a Telegram Bot is a key step in automating your messages from Google Sheets. This bot will act as the bridge between your Google Sheets and Telegram, ensuring that updates are communicated promptly. Follow these steps to set up your own Telegram bot.
Botfather Instructions
To create a new bot, you must interact with the BotFather, which is the official bot for managing bots on Telegram.
- Open the Telegram app and search for BotFather.
- Start a chat with BotFather by clicking the Start button.
- Type
/newbotand send the message. - BotFather will ask for a name for your bot. Choose a name that describes its function.
- Next, you need to choose a unique username for your bot. The username must end with ‘bot’.
- Once you’ve chosen a valid username, BotFather will provide a message with an API token.
Obtaining Api Token
The API token is essential for connecting your bot to Google Sheets. This token authenticates your bot and allows it to send messages.
| Step | Description |
|---|---|
| 1 | Copy the API token provided by BotFather. |
| 2 | Keep this token secure and do not share it publicly. |
| 3 | Paste the token in a safe place, as you will need it later. |
With your API token ready, you can now proceed to link it with your Google Sheets script to automate Telegram messages.
Setting Up Google Sheets
Setting up Google Sheets is the first step to send Telegram messages when a row is updated. The process involves preparing your spreadsheet and configuring triggers. These steps ensure seamless communication between Google Sheets and Telegram.
Preparing Your Spreadsheet
Start by creating a new Google Sheet or opening an existing one. Ensure the sheet contains the columns you need for your data. Label these columns clearly. This helps in identifying the information to be sent via Telegram.
For example, you might have columns like “Name,” “Email,” and “Status.” Enter some sample data in these columns to test the setup. Make sure to save your Google Sheet.
Configuring Triggers
Next, set up triggers to monitor changes in your Google Sheet. Open the Google Apps Script editor by clicking on “Extensions” and then “Apps Script.” This editor allows you to write code that responds to changes in your sheet.
In the Apps Script editor, write a function to handle the row updates. This function will be triggered each time a row is updated. You can use this function to send messages to Telegram.
To configure the trigger, click on the clock icon in the Apps Script editor. Select the function you created and choose the event type “On edit.” This means the function will run whenever a cell in your sheet is edited.
Save the trigger settings. Now, your Google Sheet is ready to send messages to Telegram when a row is updated.

Credit: www.pabbly.com
Using Google Apps Script
Sending Telegram messages when a Google Sheets row is updated can be automated using Google Apps Script. This powerful tool allows you to extend the functionality of Google Sheets and automate tasks with ease. Let’s dive into how to achieve this.
Introduction To Google Apps Script
Google Apps Script is a cloud-based scripting language for light-weight application development. It is based on JavaScript and runs on Google’s servers. This tool helps you automate tasks across Google products. With Google Apps Script, you can write custom functions, automate workflows, and even integrate with third-party services like Telegram.
To get started, open your Google Sheet and click on Extensions > Apps Script. This will open the Apps Script editor where you can write and manage your scripts.
Writing Your Script
To send Telegram messages when a row is updated, you need to write a script that connects Google Sheets with Telegram. Here is a step-by-step guide:
- Open the Apps Script editor in your Google Sheet.
- Copy and paste the following script into the editor:
function sendTelegramMessage() {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var lastRow = sheet.getLastRow();
var rowData = sheet.getRange(lastRow, 1, 1, sheet.getLastColumn()).getValues();
var message = "New row added: " + rowData[0].join(", ");
var telegramBotToken = "YOUR_TELEGRAM_BOT_TOKEN";
var chatId = "YOUR_CHAT_ID";
var url = "https://api.telegram.org/bot" + telegramBotToken + "/sendMessage?chat_id=" + chatId + "&text=" + encodeURIComponent(message);
UrlFetchApp.fetch(url);
}
function onEdit(e) {
sendTelegramMessage();
}
Replace YOUR_TELEGRAM_BOT_TOKEN and YOUR_CHAT_ID with your actual Telegram bot token and chat ID. These are necessary for sending messages.
- Save the script by clicking on the disk icon or pressing Ctrl+S.
- Set up a trigger to run the
onEditfunction whenever a row is updated:
- Go to the Apps Script editor.
- Click on the clock icon to open the triggers page.
- Click on Add Trigger and set it to run
onEditfrom the dropdown menu. - Choose From spreadsheet and On edit as the event type.
Click Save to activate the trigger. Now, every time you update a row in your Google Sheet, a Telegram message will be sent automatically.
This script is a simple way to integrate Google Sheets with Telegram using Google Apps Script. It allows you to automate notifications, making your workflow more efficient.
Integrating Google Sheets With Telegram
Integrating Google Sheets with Telegram can streamline your workflow. When a row in your Google Sheets is updated, you can automatically send a Telegram message. This can be useful for notifications, reminders, or updates. The process is simple and involves a few key steps.
Connecting To Telegram Api
First, you need to connect to the Telegram API. This allows you to send messages from Google Sheets. Follow these steps:
- Open the Telegram app.
- Search for BotFather and start a chat.
- Type
/newbotand follow the instructions. - Once your bot is created, you will receive an API token.
Save this API token. You will use it to connect Google Sheets to Telegram.
Sending Messages
Now, you need to set up Google Sheets to send messages. Use the following script in Google Sheets:
function sendTelegramMessage(chat_id, message) {
var token = 'Your_Telegram_Bot_API_Token';
var url = 'https://api.telegram.org/bot' + token + '/sendMessage';
var payload = {
'chat_id': chat_id,
'text': message
};
var options = {
'method': 'post',
'payload': payload
};
UrlFetchApp.fetch(url, options);
}
Replace Your_Telegram_Bot_API_Token with the token you received from BotFather. Next, create a trigger to run this script when a row is updated:
- Go to Extensions > Apps Script.
- Paste the script in the editor.
- Save the script.
- Click on the clock icon to create a trigger.
- Set the trigger to run
sendTelegramMessageon onChange event.
Each time a row is updated, your script will run and send a message to the specified chat.
Testing The Integration
Testing the integration is a crucial step to ensure that your Telegram messages are sent correctly when a Google Sheets row is updated. This process involves simulating row updates and troubleshooting common issues to confirm that everything works as expected.
Simulating Row Updates
To test the integration, start by manually updating a row in your Google Sheet. Add new data or modify existing entries. Observe if the changes trigger a Telegram message. This will help you confirm that the integration is functional.
Perform multiple updates to ensure consistency. Change different cells and see if each update sends a message. This will verify that all kinds of updates are detected. If messages are sent promptly, the integration is likely working well.
Troubleshooting Common Issues
If you do not receive a Telegram message, check your script. Ensure that it is correctly configured and has the necessary permissions. Sometimes, minor errors in the script can prevent messages from being sent.
Review the Google Sheets API settings. Confirm that the API is enabled and has access to your spreadsheet. Also, check the connectivity between Google Sheets and your Telegram bot. Issues in the connection may cause failures in message delivery.
Finally, examine the logs for any error messages. Logs can provide valuable insights into what went wrong. Fix any issues indicated by the logs to restore functionality. By systematically addressing these potential problems, you can ensure a smooth integration.
Advanced Features
Advanced Features can greatly enhance your experience with sending Telegram messages when a Google Sheets row is updated. These features offer flexibility and control, allowing you to tailor notifications and manage multiple events efficiently.
Customizing Notifications
Customizing notifications ensures that the right message gets to the right person. You can set specific conditions for each notification. For example, notify a user when a sales target is hit.
Use the following script to customize your notifications:
function sendTelegramMessage(sheet, rowData) {
var message = "New update on Google Sheets: " + rowData;
var url = "https://api.telegram.org/bot/sendMessage?chat_id=&text=" + encodeURIComponent(message);
UrlFetchApp.fetch(url);
}
Key points to consider while customizing:
- Identify the specific condition for sending a notification.
- Craft the message to be clear and concise.
- Use variables to dynamically insert row data into the message.
Handling Multiple Events
Managing multiple events can be tricky. With the right approach, it becomes manageable. You may need to send different messages based on various events.
Use the following code to handle multiple events:
function handleMultipleEvents(sheet, rowData) {
var eventType = rowData[2]; // Assume event type is in the third column
if (eventType === "Sale") {
sendTelegramMessage(sheet, "Sale made: " + rowData);
} else if (eventType === "Support") {
sendTelegramMessage(sheet, "Support request: " + rowData);
}
}
Steps to handle multiple events:
- Identify the event type from the row data.
- Set different messages based on the event type.
- Use conditional statements to manage the flow.
This method ensures that you can handle different types of updates efficiently.
Frequently Asked Questions
How Do I Set Up Telegram Notifications For Google Sheets Updates?
To set up Telegram notifications, use Google Apps Script. You need to create a script that triggers on Google Sheets updates. The script sends a message to a specified Telegram chat.
What Are The Steps To Connect Google Sheets To Telegram?
First, get a Telegram bot token. Then, write a Google Apps Script. Link the script to your Google Sheet. Finally, set a trigger to monitor updates.
Can I Customize The Telegram Message Content?
Yes, you can. Modify the Google Apps Script to include specific data from your Google Sheet. This lets you personalize the message content.
Do I Need Coding Skills For This Setup?
Basic coding skills are helpful. Understanding Google Apps Script and Telegram Bot API is necessary. However, many online tutorials can guide you step-by-step.
Conclusion
Sending Telegram messages from updated Google Sheets is simple and efficient. This method keeps you informed in real-time. No need to check sheets constantly. Automate your workflow with these easy steps. Stay organized and save time. Try it today for better efficiency.
Your tasks will feel more manageable. Happy messaging!


