Google Sheets combined with Google Apps Script gives you a powerful, free automation platform that can send SMS messages via the Telnxo API directly from a spreadsheet. This is useful for sending bulk SMS to contacts in a sheet, building a simple SMS broadcast tool, or triggering SMS from a Google Form submission.
What You Can Build
- Bulk SMS broadcaster — list contacts and messages in a sheet; run the script to send SMS to all rows.
- Google Forms → SMS auto-reply — send a confirmation SMS to every form respondent automatically.
- Appointment reminder sender — loop through a sheet of bookings and send reminders a day before.
- Order status notifier — paste order updates into a sheet and send status SMS to each customer.
Prerequisites
- A Google account with access to Google Sheets and Google Apps Script.
- A Telnxo API key with
sms:sendscope. - A registered Sender ID in Telnxo.
- Phone numbers in your sheet must be in E.164 format (
+91XXXXXXXXXX).
Step 1 — Set Up Your Google Sheet
Create a new Google Sheet with the following column structure:
| Column A | Column B | Column C | Column D |
|---|---|---|---|
| Name | Phone Number | Message | Status |
| Rahul Sharma | +919876543210 | Hi Rahul, your appointment is confirmed for 3 PM today. | (auto-filled) |
The Status column is written by the script after each send — showing Sent, Failed, or the error message. This prevents duplicate sends if you run the script multiple times.
Step 2 — Open Apps Script
- In your Google Sheet, go to Extensions → Apps Script.
- The Apps Script editor opens. Delete any default code in the editor.
- Paste the following script:
// Telnxo SMS Sender — Google Apps Script
// Replace these values with your own
const TELNXO_API_KEY = 'YOUR_TELNXO_API_KEY';
const SENDER_ID = 'YOURNAME'; // Your registered Sender ID
const SHEET_NAME = 'Sheet1'; // The name of your sheet tab
function sendBulkSMS() {
const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(SHEET_NAME);
const rows = sheet.getLastRow();
// Start from row 2 to skip header row
for (let i = 2; i <= rows; i++) {
const phone = sheet.getRange(i, 2).getValue().toString().trim();
const message = sheet.getRange(i, 3).getValue().toString().trim();
const status = sheet.getRange(i, 4).getValue().toString().trim();
// Skip rows already sent or with missing data
if (status === 'Sent' || !phone || !message) continue;
const result = sendSMS(phone, message);
sheet.getRange(i, 4).setValue(result);
// Pause 200ms between sends to respect rate limits
Utilities.sleep(200);
}
}
function sendSMS(phone, message) {
const url = 'https://api.telnxo.com/v1/sms/send';
const payload = JSON.stringify({ from: SENDER_ID, to: phone, message: message });
const options = {
method: 'post',
contentType: 'application/json',
headers: { 'Authorization': 'Bearer ' + TELNXO_API_KEY },
payload: payload,
muteHttpExceptions: true,
};
try {
const response = UrlFetchApp.fetch(url, options);
const code = response.getResponseCode();
const body = JSON.parse(response.getContentText());
if (code >= 200 && code < 300) {
return 'Sent';
} else {
return 'Failed: ' + (body.message || code);
}
} catch (e) {
return 'Error: ' + e.toString();
}
}
Step 3 — Store Your API Key Securely
Hardcoding your API key in the script is acceptable for personal use but not for shared spreadsheets. For better security, use Apps Script Properties:
// Store key once via Script Properties
function storeApiKey() {
PropertiesService.getScriptProperties()
.setProperty('TELNXO_API_KEY', 'your_key_here');
}
// Read from Properties in your main script
const TELNXO_API_KEY = PropertiesService.getScriptProperties()
.getProperty('TELNXO_API_KEY');
Run storeApiKey() once to save the key, then delete that function. The key is stored encrypted in Google's infrastructure and not visible in the script code.
Step 4 — Add a Custom Menu to Run the Script
function onOpen() {
SpreadsheetApp.getUi()
.createMenu('📱 Telnxo SMS')
.addItem('Send SMS to All Rows', 'sendBulkSMS')
.addToUi();
}
After saving and reloading the sheet, a 📱 Telnxo SMS menu appears in the Google Sheets toolbar. Click it and select Send SMS to All Rows to trigger the bulk send.
Step 5 — Automate via Google Forms (Optional)
To send an auto-reply SMS whenever a Google Form is submitted:
- Link your Google Form to a Google Sheet (Form → Responses → Link to Sheets).
- In Apps Script, set a trigger on the sheet:
function onFormSubmit(e) {
const phone = e.values[2]; // Adjust index to match your form's phone field
const name = e.values[1]; // Name field
const message = 'Hi ' + name + ', we received your submission. We will contact you shortly.';
sendSMS(phone, message);
}
- Go to Triggers (clock icon) → Add Trigger →
onFormSubmit→ From spreadsheet → On form submit. - Now every form submission automatically triggers an SMS to the respondent.
Troubleshooting
| Problem | Fix |
|---|---|
| Status column shows Failed: invalid_api_key | Verify your API key is correct and has sms:send scope |
| Status shows Failed: invalid_phone_number | Ensure phone numbers are in E.164 format: +919876543210 not 09876543210 |
| Script runs but nothing happens | Check that all rows already have Sent in column D — the script skips already-sent rows |
| Authorization popup appears | Apps Script requires permission to make external URL requests — click Allow when prompted |
| Rate limit errors for large lists | Increase the Utilities.sleep(200) delay; for very large lists consider batching across multiple script runs |