This repository contains a Google Apps Script example for sending messages through smsgateway24.com from Google Sheets.
It is a simple cross-platform alternative to Excel macros and works well on macOS, Windows, and Linux.
You have two options:
Use the prepared Google Sheet, make your own copy, fill in your settings, and start sending messages.
Recommended if you want the fastest setup.
Link to the template: Google Sheet Template
Create a blank Google Sheet, add the required sheets and columns, paste the script into Google Apps Script, and use it with your own data.
Recommended if you want full control over the file structure.
You need the following values from your SMSGateway24 account:
- token
- device_id
- sim
Log in to smsgateway24.com and open the Profile section.
From there you can get:
- your token
- your device_id
You should also decide which sim slot or channel you want to use:
0= SIM slot 1 for SMS1= SIM slot 2 for SMS2= WhatsApp Business3= WhatsApp Personal4= RCS channel 15= RCS channel 2
- Open the shared Google Sheet template.
- Click File → Make a copy.
- Save the copy to your Google Drive.
- Open the copied file.
- Go to the
configsheet. - Fill in your values:
api_tokendevice_idsim
- Go back to the main sheet with contacts.
- Add your recipients and message text.
- Refresh the spreadsheet page.
- Open the SMS Gateway menu and run the script.
Use the following columns in the main sheet:
| phone | name | message | timetosend | customerid | urgent | status | response | sms_id |
|---|
The config sheet must look like this:
| key | value |
|---|---|
| api_token | your_token_here |
| device_id | 12345 |
| sim | 0 |
Set the phone column format to Plain text in Google Sheets so the + sign is preserved.
Create a new spreadsheet in Google Sheets.
Create a sheet for your contacts, for example Sheet1.
Add this header row:
phone | name | message | timetosend | customerid | urgent | status | response | sms_id
Create another sheet named exactly:
config
Add this content:
key | value
api_token | your_token_here
device_id | 12345
sim | 0
In the spreadsheet, open:
Extensions → Apps Script
Delete the default code in the editor and paste the script from this repository into the main script file, usually Code.gs.
Save the project.
Refresh the spreadsheet page in your browser.
After that, you should see a custom menu called:
SMS Gateway
The first time you run the script, Google will ask for authorization.
- Click the custom menu.
- Run the sending function.
- Accept the requested permissions.
- Reload the spreadsheet if needed.
Fill in the rows with your contact data and messages, then run the send function from the custom menu.
+4917660188224 | John Doe | Hello John, this is a test message | 2026-04-08 18:00:00 | 1001 | 1 | | |
- This script is part of the SMSGateway24 project.
- The script sends requests to the SMSGateway24 API endpoint.
- Your
api_token,device_id, andsimvalues are not hardcoded in the script. They are loaded from theconfigsheet. - Each user should use their own copy of the spreadsheet and their own configuration values.
- Do not share your personal token publicly.
For production use, the recommended flow is:
- Create your own copy of the template.
- Set your token and device settings in the
configsheet. - Use the main sheet to manage contacts and messages.
- Run the script from the spreadsheet menu.
For account-related values such as token and device_id, log in to your account at smsgateway24.com and open the Profile section.