forward sms to google sheets, receive sms, otp automatically

How to Automatically Forward SMS to Google Sheets [Updated 2025]

Do you want to automatically collect incoming SMS messages in a Google Sheet for easier tracking, reporting, or analysis? With AutoForwardText, you can forward all your incoming messages to a Google Apps Script web app, which logs them in Google Sheets — no complex servers needed.

This guide will show you exactly how to set it up step by step.

Why Forward SMS to Google Sheets?

  • Centralized record keeping: Keep all your messages in one place.
  • Automated workflows: Combine Google Sheets with formulas, filters, or dashboards.
  • Easy sharing: Share SMS logs with team members instantly.
  • Data analysis: Track message patterns, response times, or customer interactions.

What You’ll Need

  1. AutoForwardText is installed on your iPhone or Android phone — this will forward incoming SMS messages to a Google Apps Script endpoint.
  2. A Google account and a Google Sheet to store your messages.
  3. Basic familiarity with Google Apps Script (don’t worry — we’ll guide you step by step).

Step 1: Create a Google Sheet

  1. Open Google Sheets and create a new spreadsheet.
  2. Name it something like SMS Logs.
  3. Add a header row with the following columns:
Timestamp | From | Body | RawPayload

This will store the message time, sender, message body, and full payload for debugging.

Copy the Spreadsheet ID from the URL (the long string between /d/ and /edit) — you’ll need it.

Step 2: Open Google Apps Script

  1. In your spreadsheet, go to Extensions → Apps Script.
  2. This opens the Apps Script editor, where we’ll write a small script to receive SMS messages from AutoForwardText and log them in the sheet.

Step 3: Add the Webhook Script

Paste the following code into the editor. Replace YOUR_SHEET_ID_HERE with the Sheet ID from your spreadsheet URL:

const SHEET_ID = 'YOUR_SHEET_ID_HERE';
const SHEET_NAME = 'Sheet1';

function _getSheet() {
  return SpreadsheetApp.openById(SHEET_ID).getSheetByName(SHEET_NAME);
}

// GET endpoint for testing
function doGet(e) {
  return ContentService.createTextOutput(JSON.stringify({ status: 'ready', timestamp: new Date().toISOString() }))
                       .setMimeType(ContentService.MimeType.JSON);
}

// POST endpoint to receive SMS from AutoForwardText
function doPost(e) {
  try {
    let payload = {};

    if (e.postData && e.postData.type && e.postData.type.includes('json')) {
      payload = JSON.parse(e.postData.contents || '{}');
    } else {
      payload = e.parameter || {};
    }

    const from = payload.PhoneNumber || payload.from || '';
    const body = payload.Content || payload.body || '';

    const sheet = _getSheet();
    sheet.appendRow([new Date().toISOString(), from, body, JSON.stringify(payload)]);

    return ContentService.createTextOutput(JSON.stringify({ status: 'ok' }))
                         .setMimeType(ContentService.MimeType.JSON);
  } catch (err) {
    Logger.log(err);
    return ContentService.createTextOutput(JSON.stringify({ status: 'error', message: err.message }))
                         .setMimeType(ContentService.MimeType.JSON);
  }
}

Why this works:

  • Accepts both JSON and form-encoded POST requests.
  • Logs timestamp, sender, message body, and full payload.
  • Captures errors for easy debugging.

Step 4: Deploy as a Web App

  1. Click Deploy → New deployment → Web app.
  2. Set:
    • Execute as: Me
    • Who has access: Anyone
  3. Copy the /exec URL — this will be the webhook endpoint for AutoForwardText.

⚠️ Only the /exec URL works for webhooks; the /dev URL will not work.

Ignore the warnings related to app access.

Step 5: Configure AutoForwardText

  1. Log in to the AutoForwardText.com online dashboard.
  2. Go to Forwarding settings → Webhook/HTTP Forwarding.
  3. Paste the Apps Script /exec URL as the endpoint.
  4. Enable all the fields.
  5. Save and enable forwarding.

Now, every incoming SMS on your phone will be automatically sent to your Google Sheet.

Step 6: Test Your Setup

  1. Send a test SMS to your phone.
  2. Check your Google Sheet — a new row should appear with timestamp, sender, and message.

Optional: You can also test with curl:

curl -X POST 'YOUR_EXEC_URL_HERE' -d 'From=+1234567890' -d 'Body=Test message'

If you need assistance, please get in touch with our help desk.

Conclusion

Forwarding SMS to Google Sheets using AutoForwardText and Google Apps Script is simple, reliable, and fully automated. Once set up, every incoming message is logged in real time, giving you a central repository for analysis, reporting, or business workflows.

This setup turns your Android phone into a smart, automated SMS logger — freeing you from manually tracking important messages.

Stop losing messages — log them automatically

Use AutoForwardText to forward incoming SMS straight to Google Sheets (or any webhook). Quick setup, reliable delivery, and full control over your data.

  • ✔️ Forward texts to Google Sheets, webhooks, or email
  • ✔️ Supports JSON & form payloads (perfect for Google Apps Script)
  • ✔️ Lightweight, battery-friendly Android forwarding

By signing up you agree to our Terms and Privacy Policy.

Scroll to Top