Sumair Ahmed
Sumair Ahmed

Reputation: 81

send sms using Google Scripts on google spreadsheet

i want a script that sends a message to a particular cell number on event of an update in my spreadsheet or through a add menu button option. i tried to find but couldn't see any option like that.

Upvotes: 4

Views: 20497

Answers (3)

AliceKeeler Keeler
AliceKeeler Keeler

Reputation: 11

I attempted to

try{

      MailApp.sendEmail(phone+'@txt.att.net',subject,body);
    }
    catch(err){}

The email sent. It worked. BUT it did not send the text. HOWEVER, if I REPLIED to the email (from sent mail) to the phone plus carrier code it did go through. But only the reply.

Upvotes: 0

Birminghamilton
Birminghamilton

Reputation: 141

One of the simplest ways is to write a script to send it via email using your cell carriers email code.

Here's a list of codes https://20somethingfinance.com/how-to-send-text-messages-sms-via-email-for-free/ .

Under tools select script editor and basically just copy the following code in. Change up the EmailTo, Subject, and Body accordingly.

function sendText() {
  var EmailTo = "your10digitNumber@CellcarrierCode";
  var subject = "Whatever";
  var body = "Text";

  MailApp.sendEmail(EmailTo, subject, body);
}

In the script editor under Edit select current project triggers and setup however you want.

Upvotes: 10

Brady
Brady

Reputation: 322

Adding a menu or setting up an onEdit even function in a document is pretty straightforward (just a few lines of code depending on the complexity of your application). Google Apps Script does not have built in functionality for SMS/Text messaging however.

If you want to accomplish this sms functionality, you will need to identify a company that offers an SMS/Text messaging API and access the API with a custom script. Twilio is a great tool (although not free) or you may find another API that fits your needs based on your region in this list of SMS APIs: http://blog.mashape.com/list-of-50-sms-apis/.

Once you have your service/API selected and set up and have the API Documentation, refer to the following Google Developers page to access the service API with Apps Script: https://developers.google.com/apps-script/guides/services/external.

If you're not well versed in using APIs, you can instead use MailApp to send e-mail or log any activity in another spreadsheet for tracking purposes. One other low-tech solution to consider is that spreadsheets have a built-in edit notification under Tools > Notification Rules.

Upvotes: 3

Related Questions