Skip to content

On a schedule

Log Facebook Page post stats to Google Sheets

Every Monday a Posts tab is rewritten with each Facebook Page post from the last 30 days and its reactions, comments, shares and link.

Runs
On a schedule
Apps
Facebook Pages, Google Sheets
AI
Not needed
Access
pages_show_list, pages_read_engagement; Google Sheets read+write

Send this to your assistant

Create a ClickRuntime automation: every Monday at 7am, refresh the Posts tab of my sheet with each post on my Facebook Page from the last 30 days: date, first line of text, reactions, comments, shares and link.

Paste it into your assistant. It tells you what it will send or change before it runs live.

First time? Adding ClickRuntime to your assistant takes about two minutes.

Why use it

Why teams use this automation

Knowing which posts worked is the basis of a content plan, but Facebook's post list is hard to sort and compare. Most people end up guessing from memory which topics did well.

This automation rewrites a Posts tab every Monday with the Page's posts from the last 30 days, their reactions, comments and shares, sorted with the strongest posts first.

Small business owners, social media managers and agencies use the tab in their weekly content meeting.

What you get out of it

  • Best posts at the top

    Sorting by total interactions shows at once which topics and formats people responded to.

  • Ready for the weekly meeting

    The tab is fresh every Monday morning without anyone exporting data.

  • First line of each post

    The opening text helps identify posts without opening Facebook.

  • Comments counted separately

    High comment counts point to posts that started conversations, not just likes.

  • Links to each post

    Open a post directly to reply to comments or reuse it.

How it works

What happens, step by step

  1. Every Monday ClickRuntime lists the posts your Page published in the last 30 days.

  2. For each post it reads the reaction, comment and share counts.

  3. The Posts tab is rewritten, sorted by total interactions, so the best posts are at the top.

Before it runs live

  • Connect Facebook Pages
  • Connect your Google Sheets account and pick the spreadsheets it may use

What you get

RunsOn a schedule
Log Facebook Page post stats to Google Sheetstoday, 9:00Succeeded
Google Sheets · Social › Posts2026-11-04 | "Our winter menu is here: three new soups…" | 214 reactions | 38 comments | 19 shares | facebook.com/northwind/posts/…

Build your own

Need it to work differently?

This template is a starting point. Copy the prompt and change it, or describe a different automation from scratch, with your own conditions, more apps or an AI step. Your assistant writes it, tests it and runs it on ClickRuntime.
  • Your own rules

    Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.

  • Any number of apps

    One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.

  • AI where it helps

    Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.

  • On a schedule or on each event

    Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.

Changes you can ask for

  • Run it at a different time, more or less often, or only on weekdays
  • Add an AI step, for example to summarize, sort or draft a reply
  • Add another app, for example also send it to Slack
  • Combine it with other Facebook Pages and Google Sheets steps into one automation

Under the hood

The code that runs this automation

This is the Python script that runs each time the automation starts. Your AI assistant writes it for you when you send the prompt, and you allow each step in your assistant. To change how the automation works, describe the change to your assistant and it updates the script for you. For every function it can use, see the script reference.
log_facebook_page_post_stats_to_google_sheets.pyexample
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from datetime import date, timedelta
from clickruntime import on_trigger, credentials, http, report_fetched

PAGE_ID = "1234567890"
SHEET_ID = "your-spreadsheet-id"
FIELDS = "message,created_time,permalink_url,shares,reactions.summary(total_count).limit(0),comments.summary(total_count).limit(0)"

def page_token():
    r = http.get(f"https://graph.facebook.com/v21.0/{PAGE_ID}", params={"fields": "access_token",
                 "access_token": credentials.connection("facebook", "work")})
    r.raise_for_status()
    return r.json()["access_token"]

@on_trigger
def run(event):
    url, params = f"https://graph.facebook.com/v21.0/{PAGE_ID}/published_posts", {
        "fields": FIELDS, "since": (date.today() - timedelta(days=30)).isoformat(), "limit": 100, "access_token": page_token()}
    posts = []
    while url:
        page = http.get(url, params=params).json()
        posts += page.get("data", [])
        url, params = (page.get("paging") or {}).get("next"), None
    report_fetched(len(posts))
    rows = []
    for p in posts:
        reactions = p.get("reactions", {}).get("summary", {}).get("total_count", 0)
        comments = p.get("comments", {}).get("summary", {}).get("total_count", 0)
        shares = p.get("shares", {}).get("count", 0)
        text = (p.get("message") or "").split("\n")[0][:120]
        rows.append([p["created_time"][:10], text, reactions, comments, shares, reactions + comments + shares, p["permalink_url"]])
    rows.sort(key=lambda r: -r[5])
    tab = build("sheets", "v4", credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False).spreadsheets().values()
    tab.clear(spreadsheetId=SHEET_ID, range="Posts!A:G").execute()
    tab.update(spreadsheetId=SHEET_ID, range="Posts!A1", valueInputOption="RAW", body={"values": [
        ["Date", "Post", "Reactions", "Comments", "Shares", "Total", "Link"]] + rows}).execute()
    return {"posts": len(rows)}

FAQ

Common questions

Why only the last 30 days?
Most interaction on a post happens in its first weeks, and a 30-day window keeps the tab focused. Change the number of days at the top of the script if you want a longer view.
Can it include reach or views per post?
Yes, if your app has read_insights: ask your assistant to add a post insights call for each post and a column for views.
Does it include posts by visitors?
No. published_posts returns posts the Page itself published, which is what you usually want to measure.
What permissions does it need?
pages_show_list, pages_read_engagement; Google Sheets read+write. Nothing else in your accounts is used.
Does it need AI?
No. It runs without AI, so it doesn't use your plan's AI allowance.
How many runs does it use?
One run each time it runs (on a schedule). Checks that find nothing to do and stop right away aren't counted.
Can I change how it works?
Yes. Describe the change to your AI assistant, for example a different schedule, channel or filter. It updates the automation, tests it and tells you what changed.

Set up “Log Facebook Page post stats to Google Sheets” from your assistant

Copy the prompt above, or connect your assistant first. Free plan, no credit card.