Google Sheets Formula & Telegram Message ✈️ – Telegram Group

Haley

Google Sheets Formula & Telegram Message ✈️

Here’s a formula sample with IMPORTXML:

=IMPORTXML(
"https://script.google.com/macros/s/AKfyc...VnFp/exec?msg="&if(C3>500;"Hey sum is > 500!"&C3;"") &
"&chat_id=13246789";"/table/row")

It will send a new message to Telegram.

The idea is based on this post by Tanaike.

By the way, IMPORTDATA formula will also work:

=IMPORTDATA(
"https://script.google.com/macros/s/AKfyc...VnFp/exec?msg="&if(C3>500;"Hey sum is > 500!"&C3;"") &
"&chat_id=13246789")

Sample message:

telegram google sheets

Install

Full installation requires 4 files:

telegram google sheets2
Please see this instruction on Miro Board

All files are available for view/copy here.

#1 of 4. 🤖 Telegram Bot

The process is not easy to repeat. Please carefully follow these steps:

telegram google sheets3
Here’s the official instruction on how to create a new Bot on Telegram

The next steps are inside the script editor. After you save the code and the project, do the following:

telegram google sheets4
When you deploy WebApp, Google will ask you to allow the script to run. Here’s an article on how to pass authorization: https://spreadsheet.dev/authorizing-an-apps-script

Next, go back to Telegram.

telegram google sheets5
The bot must be an admin to read messages

Next, go back to your script editor:

telegram google sheets6
👆🏼 The response from Apps Script looks is message info in JSON format. Copy chat id from it.

From the same script, you may already send a message to Telegram! To test your Bot:

#2 of 4. ✏️ Memory

Please copy my Spreadsheet to use it as a Memory holder. It would be your place with information about sent messages to Telegram.

telegram google sheets7

After you make a copy, please remember the file ID. Here’s mine:

1pI12qRVgIY7i03tVdd9jNd2GwPDgOi1RLthdpVpdMD8

I’ve copied it from the browser URL:

telegram google sheets8

You’ll need this ID in the next step.

For now, there’s an issue. When you open a Spreadsheet, your formula will recalculate and send the same message again. One way to resolve the issue of duplicates is to write all sent messages into memory.

🟢Formula → 📢Web-App → 💬Telegram + ✏️Memory

I had to decide which type of memory to use. I stopped on simple writing data to a Sheet for these reasons:

#3 of 4. 📢 WebApp for Beeper

In this step you may need some information from previous steps:

Please follow these steps:

telegram google sheets9
Please don’t forget to change: 1) token, 2) Memory Spreadsheet ID

#4 of 4. ✈️ Formula 2 Telegram

In this step you may need some information from previous steps:

Here’re we finally installed the code. Now you may use formulas to send messages to Telegram. I’ve made a template to make it easier:

telegram google sheets10

This template demonstrates how to use the code.

The key here is to launch WebApp with a formula. The process is the same as if you run this URL with parameters from your browser as any other URL.

Here’s what WebApp URL looks like:

https://script.google.com/macros/s/LongLongKeyGoesHere…/exec

That’s not all! You also need to pass 2 parameters to your script. Your final URL will hold these parameters: message and chat id. Here’s a sample URL with parameters:

https://script.google.com/macros/s/LongLongKeyGoesHere…/exec?msg=Hello&chat_id=-12346789

URL has 2 parameters here:

And here the fun part starts. As this URL is passed via formula, you can use any other formulas to combine your message into Telegram. This means you now can control which messages will come to Telegram:

First of all please note: the message should be encoded because you send it via Web URL. Luckily we have a native Google Sheets function to encode the text: ENCODEURL. Please encode the message only. Your final URL may look like this:

https://script.google.com/macros/s/LongLongKeyGoesHere…/exec?msg=Hellooooo%20There&chat_id=-650350317

Hellooooo%20There = encoded string. The actual message is “Hellooooo There”.

To get your text encoded simply use this formula:

=ENCODEURL("Hellooooo There")

Put your message inside this formula and see how text is encoded.

Telegram API may change in the future. It now supports these HTML tags:

<b>Bold</b>
<i>Italic</i>
<a href="https://twitter.com/max__makhrov">URL</a>
<code>Code inside text</code>
<pre>Code</pre>

Try these texts and see what message you’ll get.

One important tag is not supported by Telegram, but I’ve implemented it into the script:

<br>

👆🏼 This one will create a new line. Please try:

Thanks for reading!<br>Max
telegram google sheets11

Finally to send a message try one of the following formulas:

=IMPORTXML(
"https://script.google.com/macros/s/AKfyc...VnFp/exec?msg="&if(C3>500;"Hey sum is > 500!"&C3;"") &
"&chat_id=13246789";"/table/row")

or

=IMPORTDATA(
"https://script.google.com/macros/s/AKfyc...VnFp/exec?msg="&if(C3>500;"Hey sum is > 500!"&C3;"") &
"&chat_id=13246789")

You’ll need to change the Web App URL and chat_id, and now that’s all!

Ten articles before and after

KGF Chapter 2 Movie Telegram Link to Download Movie for Free – Telegram Channels -Telegram

Best telegram groups for May and June 2022 – Telegram GURU

Best Telegram Furry Groups to Join In 2022 – TelegramGuru

Best Telegram channels for Books – Telegram Channels -Telegram

Get Telegram Chat ID. How to get a Chat ID of a Telegram… – Telegram Group

800 Minutes to Hours ▷ What is 800 Minutes in Hours and Minutes?

Tasker and Telegram integration: live location – Telegram Group

How to Write/Draw on a Shared Screen or Whiteboard in Zoom- Telegram Tutorial

17 Best Telegram Tamil Movie Channels 2022 (Latest Collection)

How to enable comments in Telegram channel – Telegram Group

About Me

Pretium lorem primis senectus habitasse lectus donec ultricies tortor adipiscing fusce morbi volutpat pellentesque consectetur risus curae malesuada dignissim lacus convallis massa mauris.