Send SMS 📲 event updates or discount codes using Twilio from a Google Sheet

PART 1 OF 2

Whether it’s a dinner reservation confirmation, a discount code, or a status update via SMS; it’s handy to be able to use a Google Sheet as an interface where you enter desired phone numbers to text along with a unique message for each, especially if you need to concatenate or produce randomized data using formulas in a Sheet as the message.

In this article I will walk you through how to use a Google Sheet to send text messages using Twilio’s free trial account (an online communications provider that offers texting, calling, etc).

Optionally if you would like to create a basic interface to collect phone numbers from external users into your sheet rather than manually entering them, visit this article.

Follow me on Twitter / Source code in GitHub

Prerequisite

  • Access to creating a Google Sheet.
  • Twilio text messaging account (contains a free trial).

Try it

1. Create a Twilio account (free trial comes with $15 to spend).

2. Copy Google Sheet with script

  • At the top of the script, replace with your Twilio Account ID, Auth token, and the phone number from your Twilio account.

Optional if you wish to enter phone numbers via the web app you can both directly enter phone numbers manually in the “Phone number” column in the sheet and via the web app. This is possible since the web app simply appends new data off the last row of data entered in the sheet, so it dynamically enters data off where you last left off.

3. Prepare message for SMS

  • Refresh your Google Sheet
  • Enter a message in the “Message” column (ex: “Hi this is a message”)
  • A new menu at the top of the sheet called “Send SMS” should have been displayed after a few seconds of refreshing the sheet.
Custom menu created from sheet’s script
  • Click Send SMS menu > Send to All

4. Authorize script to send on your behalf

  • When prompted, click the “Review permissions” and click “Allow” so the script can send texts on your behalf.

Note: If you get a warning that “This app isn’t verified,” continue with the verification process by clicking “Advanced” and then scroll down and click the grey text at the bottom that begins with “Go to…”

  • A text message should have been sent to your phone and the “Status” column should have been updated with “Sent” and the date.

5. [OPTIONAL] Continue to send messages moving forward via the Twilio trial.

  • If you wish to send more messages via the Twilio trial, you can only do so to your personal phone. You can continue to enter that number via the web app or enter it manually in the sheet and simply change the message in the “Message” column to something new.
  • Via Twilio membership you can continue to use this script if you purchase a Twilio account and send to phone numbers other than your own.

--

--

Sustainability and Tech (@open_eco_source Twitter)

Developer Advocate @Google. Vegan. Accessibility to cloud tech and permaculture knowledge 4 all. Decolonize. These are my opinions my friends.