Skip to content

Reddit and X data in Google Sheets

A short Apps Script calls ChatterAPI and writes subreddit posts, search results or tweets into a sheet. You don't install an add-on. The key lives in the script's properties, not in a cell.

REST base URLhttps://api.chatterapi.com/v1

What you get

  • Reddit and X results as rows: title, subreddit, score, comments, date and link.
  • A script you can run by hand or on a time trigger.
  • No Reddit or X developer account.

Set it up

  1. Create an API key

    Sign in at chatterapi.com/signup with Google and create a key on the Keys page. You get 100 free credits. A ca_test_ key returns recorded samples for 0 credits, which helps while you set things up.

  2. Open Apps Script and store the key

    In the sheet, open Extensions, Apps Script. In Project Settings, add a script property named CHATTERAPI_KEY and set your key as the value.

  3. Paste the script

    The script fetches a subreddit's top posts for the week and writes one row per post into the active sheet.

    Code.gs
    function topPosts() {
      const key = PropertiesService.getScriptProperties().getProperty('CHATTERAPI_KEY');
      const url = 'https://api.chatterapi.com/v1/reddit/subreddits/SaaS/posts?sort=top&time=week';
      const res = UrlFetchApp.fetch(url, {
        headers: { Authorization: 'Bearer ' + key },
        muteHttpExceptions: true,
      });
      const body = JSON.parse(res.getContentText());
      if (res.getResponseCode() !== 200) throw new Error(body.error ? body.error.message : res.getContentText());
      const rows = body.data.map((p) => [p.createdAt, p.subreddit, p.title, p.score, p.numComments, p.url]);
      const sheet = SpreadsheetApp.getActiveSheet();
      sheet.getRange(sheet.getLastRow() + 1, 1, rows.length, rows[0].length).setValues(rows);
    }
  4. Run it, then schedule it

    Run topPosts once and allow the permissions. To keep the sheet fresh, add a time-driven trigger under Triggers.

What the script reads

The request returns JSON like this, and each item becomes a row. This is a real recorded response.

curl "https://api.chatterapi.com/v1/reddit/subreddits/SaaS/posts?sort=top&time=week" \
  -H "Authorization: Bearer $CHATTERAPI_KEY"
response, first 2 rows
{
  "data": [
    {
      "id": "1wwnhbt",
      "fullname": "t3_1wwnhbt",
      "title": "I've created Open Source 100% Rust clean-room replacements for 7 of Adobe's apps: Photoshop, Illustrator, Premiere, Lightroom, After Effects, InDesign, and Acrobat Pro. Free, no subscription, and you own the source code",
      "body": "I've used Opus 5.5 to help me recreate 7 of the top Adobe apps in 100% pure native Rust:\n\n* Photoshop\n* Illustrator\n* Premiere\n* Lightroom\n* Acrobat Pro\n* After Effects\n* InDesign\n\nNo more subscriptions with cancellation…",
      "author": "ai_art_is_art",
      "subreddit": "SaaS",
      "permalink": "/r/SaaS/comments/1wwnhbt/ive_created_open_source_100_rust_cleanroom/",
      "url": "https://www.reddit.com/r/SaaS/comments/1wwnhbt/ive_created_open_source_100_rust_cleanroom/",
      "externalUrl": null,
      "score": 1773,
      "numComments": 378,
      "upvoteRatio": 0.9794037940379404,
      "createdAt": "2026-10-03T13:37:37.000Z",
      "nsfw": false,
      "locked": null,
      "media": null
    },
    {
      "id": "1wvjgm2",
      "fullname": "t3_1wvjgm2",
      "title": "I made $7,802 today",
      "body": "Pretty stoked on this.\n\nI do B2B cold SMS marketing, not many of us exist.\n\nAsk me anything.\n\nMy Youtube Channel (more info):\n\nhttps://youtube.com/@mrkylebanks",
      "author": "OkPositive9373",
      "subreddit": "SaaS",
      "permalink": "/r/SaaS/comments/1wvjgm2/i_made_7802_today/",
      "url": "https://www.reddit.com/r/SaaS/comments/1wvjgm2/i_made_7802_today/",
      "externalUrl": null,
      "score": 614,
      "numComments": 276,
      "upvoteRatio": 0.9456681350954479,
      "createdAt": "2026-10-02T03:29:02.000Z",
      "nsfw": false,
      "locked": null,
      "media": null
    }
  ],
  "page": {
    "nextCursor": "AdxX…",
    "hasMore": true
  }
}

Recorded from a live call on . Long text is shortened and the cursor is cut. A live key is charged 2 credits for this call. A test key returns this same sample for 0 credits.

Limits worth knowing

  • Apps Script allows 20,000 URL fetch calls a day on consumer accounts and 100,000 on Google Workspace. source
  • A script can run for 6 minutes per execution and a custom function for 30 seconds, so call the API from a script on a trigger, not from a cell formula. source
  • UrlFetchApp.fetch takes headers and muteHttpExceptions options. The script uses them to send the key and read error bodies. source
  • There is no native ChatterAPI add-on for Google Sheets. The Apps Script above is the supported route.

Last checked . Sources: Apps Script UrlFetchApp, Apps Script quotas.

Questions

Can I use a formula like =REDDIT() in a cell?
You could wrap the script in a custom function, but Google caps custom functions at 30 seconds and some calls take several seconds. A menu item or a trigger is steadier.
Can I export from the free tools instead?
Yes. The free tools and the dashboard playground download CSV, and Sheets can import it.
How much does a refresh cost?
Each run makes one call and costs that endpoint's credits. A subreddit feed is 2 credits.

What people build with it

Give your agent Reddit and X data

Sign up and get 100 free credits. No card required.