X to Google Sheets, categorized posts without scrolling
Keeping up with X search results sounds simple until you do it every day. You scroll, you copy, you paste, you lose the tab, and somehow the “quick check” turns into a half-hour of chaos.
This X Sheets automation hits marketers doing social listening hardest, but founders and agency leads feel it too. You want a clean list of relevant posts, already categorized, so you can act without rereading the whole timeline.
This workflow monitors a live X search page, extracts real posts, filters out noise, and sends only the useful ones forward (including to Google Sheets). You’ll see what it automates, what you get out of it, and what to watch for before you run it daily.
How This Automation Works
The full n8n workflow, from trigger to final output:
n8n Workflow Template: X to Google Sheets, categorized posts without scrolling
flowchart LR
subgraph sg0["When Executed by Another Workflow Flow"]
direction LR
n0@{ icon: "mdi:play-circle", form: "rounded", label: "When Executed by Another Wor..", pos: "b", h: 48 }
n1["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/airtop.svg' width='40' height='40' /></div><br/>Extract posts"]
n2["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/airtop.svg' width='40' height='40' /></div><br/>Session"]
n3["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/airtop.svg' width='40' height='40' /></div><br/>Window"]
n4["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/airtop.svg' width='40' height='40' /></div><br/>End session"]
n5@{ icon: "mdi:swap-horizontal", form: "rounded", label: "Filter out NA posts", pos: "b", h: 48 }
n6["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>Parse JSON output"]
n7@{ icon: "mdi:swap-vertical", form: "rounded", label: "Inputs", pos: "b", h: 48 }
n7 --> n2
n3 --> n1
n2 --> n3
n4 --> n6
n1 --> n4
n6 --> n5
n0 --> n7
end
%% Styling
classDef trigger fill:#e8f5e9,stroke:#388e3c,stroke-width:2px
classDef ai fill:#e3f2fd,stroke:#1976d2,stroke-width:2px
classDef aiModel fill:#e8eaf6,stroke:#3f51b5,stroke-width:2px
classDef decision fill:#fff8e1,stroke:#f9a825,stroke-width:2px
classDef database fill:#fce4ec,stroke:#c2185b,stroke-width:2px
classDef api fill:#fff3e0,stroke:#e65100,stroke-width:2px
classDef code fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px
classDef disabled stroke-dasharray: 5 5,opacity: 0.5
class n0 trigger
class n5 decision
class n6 code
classDef customIcon fill:none,stroke:none
class n1,n2,n3,n4,n6 customIcon
The Problem: X Research Is Fast to Start, Slow to Finish
You open an X search, scroll a little, and think you’ll just grab a few posts. Then you realize half the results are off-topic, a few are repeats, and the ones worth saving need context. So you copy text, paste links, try to remember why you saved it, and hope your teammate can decipher it later. Do that across multiple searches (competitors, keywords, thought leaders) and the real cost shows up: missed replies, sloppy lead tracking, and “research” that can’t be reused.
It adds up fast. Here’s where it breaks down when you keep it manual.
- You end up scrolling past dozens of irrelevant posts just to find a handful worth acting on.
- Copy-paste logging is inconsistent, so your sheet becomes a messy archive instead of a usable system.
- Categorizing by hand sounds minor, but it’s the difference between “insight” and “random pile of links.”
- When more than one person does research, the rules drift and your team stops trusting the data.
The Solution: Categorize X Search Results and Send Them to Sheets
This workflow watches an X search URL you provide, opens it in a real browser session, and pulls out posts that are actually usable. It scrolls the search results for you, extracts up to 10 valid English-language posts (the ones with /status/ in the URL), and turns them into structured data instead of screenshots and guesswork. Then it classifies each post into your categories of interest and marks anything irrelevant as [NA]. Finally, it discards the NA items and returns a clean JSON payload you can log to Google Sheets (or feed into downstream workflows for alerts, engagement, or lead tracking).
The workflow starts when another automation calls it and passes in three things: your Airtop profile, the X search URL, and your category list. From there, Airtop handles the browser session and extraction, while a code step parses the results and a filter removes anything that didn’t match your categories.
What You Get: Automation vs. Results
| What This Workflow Automates | Results You’ll Get |
|---|---|
|
|
Example: What This Looks Like
Say you track 3 X searches (your brand name, a competitor, and a topic like “AI agents”). Manually, you might spend about 15 minutes per search scrolling, grabbing links, and writing categories, which is roughly 45 minutes each day. With this workflow, you trigger it once per search and it extracts up to 10 posts automatically; even if you budget about 5 minutes to review and approve what gets logged, you’re closer to 15 minutes total. That’s about half an hour back per day, and the sheet stays clean.
What You’ll Need
- n8n instance (try n8n Cloud free)
- Self-hosting option if you prefer (Hostinger works well)
- Airtop to run an authenticated X browser session
- X (Twitter) for the search page you want monitored
- Airtop API key (get it from your Airtop dashboard)
Skill level: Intermediate. You’ll paste in a search URL, connect credentials, and adjust categories, but you won’t be writing an app.
Don’t want to set this up yourself? Talk to an automation expert (free 15-minute consultation).
How It Works
A parent workflow triggers it with your inputs. This one is designed as a sub-workflow, so it starts when another workflow calls it and passes in an Airtop profile, an X search URL, and your list of relevant categories.
Airtop starts a browser session and navigates to the search page. Because the Airtop profile is already logged into X, it can open the live search results without you touching a thing.
The workflow captures posts and turns them into structured data. It extracts up to 10 posts that match the expected pattern (including English-language text), then a code step parses the extracted JSON so it’s usable in the rest of n8n.
Irrelevant categories are filtered out. Posts tagged as [NA] are discarded so your output is “only what matters,” not “everything it saw.”
You can easily modify the category rules to fit a new campaign or client, then keep the same sheet format for reporting. See the full implementation guide below for customization options.
Step-by-Step Implementation Guide
Step 1: Configure the Subflow Trigger
This workflow starts when a parent workflow calls the trigger and passes in inputs for the X search URL, Airtop profile, and category list.
- Add the Subflow Trigger Start node as your trigger.
- In Workflow Inputs, add the input names
airtop_profile,x_url, andrelevant_categories. - Connect Subflow Trigger Start to Input Mapper.
Step 2: Connect Airtop and Initialize the Browser Session
This step maps inputs into structured fields and starts the Airtop browser session for the automated search.
- In Input Mapper, add assignments for url =
{{$json.x_url}}, profile ={{$json.airtop_profile}}, and categories ={{$json.relevant_categories}}. - Open Browser Session Init and set Proxy to
integrated. - Set Profile Name to
{{ $('Input Mapper').item.json.profile }}. - Credential Required: Connect your airtopApi credentials in Browser Session Init.
Step 3: Open the Search Window and Extract Posts
This section navigates to the search URL and extracts post data using Airtop’s extraction flow.
- In Open Search Window, set Resource to
windowand URL to{{ $('Input Mapper').item.json.url }}. - Credential Required: Connect your airtopApi credentials in Open Search Window.
- In Capture Post Data, set Resource to
extraction. - Set Prompt to the full extraction prompt string, including the category injection:
{{ $('Input Mapper').item.json.categories }}. - Keep Output Schema as provided to enforce structured results.
- Credential Required: Connect your airtopApi credentials in Capture Post Data.
/status/. Make sure your search URL returns results that match this pattern.Step 4: Terminate the Session and Filter Results
After extraction, the session is closed, JSON is parsed, and posts without a valid category are filtered out.
- In Terminate Browser Session, set Operation to
terminate. - Credential Required: Connect your airtopApi credentials in Terminate Browser Session.
- In Parse Extraction JSON, keep the provided JavaScript that parses
$('Capture Post Data').last().json.data.modelResponseand maps posts to items. - In Exclude NA Categories, set the condition to Category notContains
NAusing{{ $json.category }}as the left value.
Step 5: Test and Activate Your Workflow
Run a manual test to validate the end-to-end extraction and filtering before using the workflow in production.
- Click Execute Workflow and supply sample values for
airtop_profile,x_url, andrelevant_categories. - Confirm that Capture Post Data returns a structured
postsarray in the response. - Verify that Exclude NA Categories only outputs items with a category not containing
NA. - Once verified, switch the workflow to Active for production use.
Common Gotchas
- Airtop credentials can expire or need specific permissions. If things break, check your Airtop connection status in n8n’s Credentials screen first.
- If you’re using Wait nodes or external rendering, processing times vary. Bump up the wait duration if downstream nodes fail on empty responses.
- Default prompts in AI nodes are generic. Add your brand voice early or you’ll be editing outputs forever.
Frequently Asked Questions
About 30 minutes if your Airtop profile is already logged into X.
No. You’ll connect Airtop, paste your X search URL, and edit category text. The “code” step is already built into the workflow.
Yes. n8n has a free self-hosted option and a free trial on n8n Cloud. Cloud plans start at $20/month for higher volume. You’ll also need to factor in Airtop usage and any AI model costs if you add extra classification.
Two options: n8n Cloud (managed, easiest setup) or self-hosting on a VPS. For self-hosting, Hostinger VPS is affordable and handles n8n well. Self-hosting gives you unlimited executions but requires basic server management.
Yes, but you’ll do it in the parent workflow that calls this one. Pass a different x_url into the Input Mapper each run, then merge outputs before logging to Google Sheets. Common tweaks include changing the category list per client, saving the raw JSON for auditing, and adding a Slack or Telegram alert when a specific category appears.
Usually it’s an expired Airtop API key or the Airtop profile is no longer authenticated on X. Reconnect the Airtop credential in n8n, then open the Airtop profile and confirm you can load X manually. If it still fails, X may have triggered a login challenge, which means you need to re-verify the session before the browser automation can proceed.
Per run, it extracts up to 10 valid posts from the X search results.
For browser-based X extraction, yes, most of the time. Zapier and Make are great for API-first apps, but they tend to struggle when you need an authenticated browser session that scrolls and captures real page content. n8n also makes it easier to keep this as a reusable sub-workflow you can call from different pipelines. If all you need is “send a link to a sheet,” you might not need this much power. Talk to an automation expert if you want a quick sanity check.
Once this is running, your “research” stops being a scrolling session and becomes a reliable feed of categorized posts you can actually use. Set it up, tune your categories, and let the workflow do the repetitive part.
Need Help Setting This Up?
Our automation experts can build and customize this workflow for your specific needs. Free 15-minute consultation—no commitment required.