DEV Community

guardlabs_team
guardlabs_team

Posted on • Originally published at guardlabs.online

Connect Google Sheets to Telegram with n8n: Step-by-Step Guide

Connect Google Sheets to Telegram with n8n: Step-by-Step Guide

This guide shows you how to automatically send data from a Google Sheet to a Telegram chat, group, or channel using n8n. We will configure a Google Sheets Trigger node to detect new rows and a Telegram node to dispatch messages.

Prerequisites

- An active **n8n** instance (Cloud or self-hosted).
- A **Google Cloud Console** project with the Google Sheets API enabled.
- A **Telegram Bot** (created via @BotFather).
Enter fullscreen mode Exit fullscreen mode

Step 1: Get Telegram Bot Token and Chat ID

To send messages, n8n needs your Telegram Bot Token and the target Chat ID.

- Search for **@BotFather** in Telegram and send the command `/newbot`.
- Follow the prompts to name your bot. Copy the generated **HTTP API Token**.
- Start a chat with your new bot and send a test message.
- Retrieve your **Chat ID**. You can do this by forwarding a message from your chat to `@userinfobot`, or by accessing the following URL in your browser (replace `<YOUR_BOT_TOKEN>` with your actual token):
Enter fullscreen mode Exit fullscreen mode
https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates
Enter fullscreen mode Exit fullscreen mode

Look for the "chat":{"id":...} value in the JSON response.

Step 2: Configure Google Sheets Credentials in n8n

n8n requires OAuth2 or Service Account credentials to access your Google Sheet.

- In n8n, go to **Credentials** > **Add Credential** and select **Google Sheets OAuth2 API**.
- Follow the n8n setup instructions to create a Client ID and Client Secret in your Google Cloud Console.
- Enable the **Google Sheets API** and **Google Drive API** in your Google Developer Library.
- Authorize the credential in n8n.
Enter fullscreen mode Exit fullscreen mode

Step 3: Create the n8n Workflow

Set up a two-node workflow to trigger on new sheet rows and push them to Telegram.

  1. Add the Google Sheets Trigger Node
- Add a **Google Sheets Trigger** node to your canvas.
- Select your Google Sheets credential.
- Set **Trigger On** to `Row Added`.
- Paste your Google Sheet's URL or enter its **Document ID** (found in the sheet's URL).
- Select the specific **Sheet** (e.g., `Sheet1`).
Enter fullscreen mode Exit fullscreen mode
  1. Add the Telegram Node
- Connect the Google Sheets Trigger node to a new **Telegram** node.
- Select **Telegram API** credentials and paste your Bot Token.
- Set **Resource** to `Message` and **Operation** to `Send`.
- In the **Chat ID** field, enter your retrieved Chat ID.
Enter fullscreen mode Exit fullscreen mode

Step 4: Map Google Sheets Data to Telegram

To dynamically insert data from your spreadsheet into the Telegram message, use n8n expressions in the Text field of the Telegram node.
Click the Text field, select Expression, and construct your message using the following syntax:

New Row Added!
Name: {{ $json.Name }}
Email: {{ $json.Email }}
Message: {{ $json.Message }}
Enter fullscreen mode Exit fullscreen mode

Replace Name, Email, and Message with the actual column headers from your Google Sheet (ensure spelling and casing match exactly).

Step 5: Test and Activate

- Add a test row to your Google Sheet.
- In n8n, click **Test step** on the Google Sheets Trigger node to fetch the test data.
- Click **Test step** on the Telegram node to verify the message arrives in Telegram.
- Toggle the workflow to **Active** in the top-right corner of the n8n interface.
Enter fullscreen mode Exit fullscreen mode

Need this done fast? order this automation on Kwork (https://kwork.com/scripting/52990199/workflow-automation-with-n8n-make-connect-tools-kill-busywork).

Top comments (0)