# Publish scheduled posts to LinkedIn or X from a Google Sheet queue

Source: https://clickruntime.com/use-cases/scheduled-social-posts

> Write or generate posts in a sheet with a date and time each. Your assistant sets up an automation that publishes them when they're due and marks each row as posted.

## Can ChatGPT or Claude post to LinkedIn or X on a schedule?

An assistant can write posts, but it can't publish them at 9:00 next Tuesday. With ClickRuntime connected, the assistant sets up an automation that reads a queue in Google Sheets on a schedule and publishes each due post through the LinkedIn or X API with your connected account, then marks the row as posted.

### Why the assistant can't do this on its own

- Publishing at a set time needs something running at that time. A chat isn't.
- Posting needs a lasting sign-in to LinkedIn or X. ClickRuntime keeps the OAuth connection and refreshes it.
- A queue needs memory of what's been posted. The sheet's status column and the automation's state make sure each post goes out once.

## Set it up from your AI assistant

Prompt to copy:

> Create a ClickRuntime automation: every 15 minutes, read my Post queue sheet (columns: When, Text, Status). Publish each row whose When has passed and whose Status is empty to my LinkedIn profile, then set Status to the post link.

1. **Connect ClickRuntime to your assistant.** Add ClickRuntime as a connector (MCP server) in ChatGPT, Claude, Cursor or another MCP client, using https://clickruntime.com/api/mcp. You sign in with Google or email; there is no API key to copy. This is done once per assistant.
2. **Paste the prompt.** Start a new chat and paste: “Create a ClickRuntime automation: every 15 minutes, read my Post queue sheet (columns: When, Text, Status). Publish each row whose When has passed and whose Status is empty to my LinkedIn profile, then set Status to the post link.” Change the details (times, channels, addresses) to yours.
3. **Read the draft.** The assistant restates what will happen, asks for anything missing, such as your timezone or which channel to post to, and saves a draft automation. A draft never runs on its own, so nothing happens until you agree.
4. **Connect accounts and save keys.** The assistant asks you to connect Google (and pick the Post queue sheet) and to add LinkedIn as an app with its own OAuth details in the ClickRuntime dashboard, then sign in with the account to post as. For X, the same with an X developer app that has write access.
5. **Test it.** The assistant adds a test row due now with text you approve, runs the automation once, and shows you the post link written back to the sheet. You can delete the test post afterwards.
6. **Turn it on.** The assistant tells you what will run, when, and which services it will contact, then asks your permission to turn it on. From then on it runs on ClickRuntime's servers, and you can close the chat.
7. **Check it in the ClickRuntime dashboard.** Each run shows how many due posts it found and published. Runs that find nothing due are quick and aren't counted toward your monthly runs. Failures, such as an expired sign-in, show on the run with the error and send you an email.

Connector setup for each assistant: https://clickruntime.com/assistants

## What the assistant writes

`post_queue_linkedin.py`

```python
from datetime import datetime, timezone
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from clickruntime import on_trigger, report_fetched, credentials, http, state

SHEET_ID = "your-spreadsheet-id"
AUTHOR = "urn:li:person:your-member-id"

@on_trigger
def run(event):
    sheets = build("sheets", "v4", credentials=Credentials(credentials.connection("cr_google_sheets_picked", "work")),
                   cache_discovery=False).spreadsheets()
    rows = sheets.values().get(spreadsheetId=SHEET_ID, range="Queue!A2:C").execute().get("values", [])
    now = datetime.now(timezone.utc)
    due = [(i, r) for i, r in enumerate(rows, start=2)
           if len(r) >= 2 and (len(r) < 3 or not r[2])
           and datetime.fromisoformat(r[0]).astimezone(timezone.utc) <= now
           and not state.get(f"row:{i}:{r[0]}")]
    report_fetched(len(due))
    if not due:
        return {"summary": "Nothing due"}

    token = credentials.connection("linkedin", "brand")
    for i, (when, text, *_) in due[:5]:
        r = http.post("https://api.linkedin.com/rest/posts", headers={
            "Authorization": "Bearer " + token, "LinkedIn-Version": "202410",
            "X-Restli-Protocol-Version": "2.0.0"}, json={
            "author": AUTHOR, "commentary": text, "visibility": "PUBLIC", "lifecycleState": "PUBLISHED",
            "distribution": {"feedDistribution": "MAIN_FEED", "targetEntities": [], "thirdPartyDistributionChannels": []},
        })
        r.raise_for_status()
        post_id = r.headers.get("x-restli-id", "posted")
        state.set(f"row:{i}:{when}", post_id)
        sheets.values().update(spreadsheetId=SHEET_ID, range=f"Queue!C{i}", valueInputOption="RAW",
                               body={"values": [["https://www.linkedin.com/feed/update/" + post_id]]}).execute()
    return {"posted": min(len(due), 5)}
```

- Times in the When column are ISO dates with a timezone, such as 2026-11-18T09:00+01:00.
- Each row is remembered in state as soon as it's posted, so a failure while writing back to the sheet doesn't post twice.
- At most five posts go out per run, so a backlog doesn't flood your feed.
- LinkedIn's Posts API is versioned; the assistant checks the current version header against LinkedIn's docs when it builds this.

## A schedule, not a trigger link

Use a schedule. Every 15 minutes means posts go out within 15 minutes of their time; every 5 minutes is the shortest interval.

To publish the moment a row is approved, use a trigger link called from a button or a Sheets script instead.

## Limits

- Each network's own API rules apply: X API access depends on your X developer plan, and LinkedIn company pages need the right page role and app permissions.
- Images and video need extra upload calls; the example posts text only.
- Posting happens through your own OAuth app for each network, added in the ClickRuntime dashboard.

## Troubleshooting

### LinkedIn returns 403.

The app lacks the permission to post as that member or page, or the sign-in expired. Reconnect the account in the ClickRuntime dashboard and check the app's products in LinkedIn's developer portal.

### Posts went out at the wrong time.

The When column has no timezone, so it was read as UTC. Add the offset, or ask the assistant to read times in your timezone.

### X says the request is not permitted.

Your X app needs read and write access, and the account must be reconnected after changing it.

## Related

- [LinkedIn automations](https://clickruntime.com/apps/linkedin)
- [X automations](https://clickruntime.com/apps/x)
- [Google Sheets automations](https://clickruntime.com/apps/google-sheets)
- [Buffer automations](https://clickruntime.com/apps/buffer)
- [Notion automations](https://clickruntime.com/apps/notion)
- [ai-written-linkedin-post-on-a-schedule](https://clickruntime.com/templates/ai-written-linkedin-post-on-a-schedule)
- [cross-post-a-scheduled-content-plan-to-facebook-and-linkedin](https://clickruntime.com/templates/cross-post-a-scheduled-content-plan-to-facebook-and-linkedin)
- [share-news-from-an-rss-feed-as-linkedin-posts](https://clickruntime.com/templates/share-news-from-an-rss-feed-as-linkedin-posts)
- [Scheduled tasks in ChatGPT and Claude](https://clickruntime.com/use-cases/scheduled-tasks-in-chatgpt)
- [AI agent automations](https://clickruntime.com/use-cases/ai-agent-automations)
- [Sync data between apps](https://clickruntime.com/use-cases/sync-data-between-apps)
- [IFTTT alternative](https://clickruntime.com/alternatives/ifttt)
- [Zapier alternative](https://clickruntime.com/alternatives/zapier)
- [Docs: connections-and-secrets](https://clickruntime.com/docs/connections-and-secrets)
- [Docs: asking](https://clickruntime.com/docs/asking)

## Extend it: what you can add next

The first version is rarely the last. Because the automation is a Python script with memory, AI and any API available, you grow it by asking your assistant for the change. Each change is a new version, and a failed deploy never replaces the working one.

- **Draft next week's posts with AI into the queue for you to approve** (Built-in AI)
  Prompt: "Add to my post queue automation: every Friday, write five draft posts about our product updates into the queue with Status “draft”, and only publish rows I set to “ready”."
- **Cross-post the same row to X with a shorter version** (Any app or API)
  Prompt: "Change my post queue automation so each row is also posted to X, shortening the text to fit if needed."
- **Rewrite each post for the network: longer for LinkedIn, shorter for X** (Built-in AI)
  Prompt: "Change my post queue automation so it adapts the text per network: keep LinkedIn as written, and write a shorter version for X."
- **Turn each new blog post into a queued social post** (Trigger links)
  Prompt: "Add a trigger link to my post queue automation: when our CMS publishes a blog post, add a row with a short post and the link, due tomorrow at 9:00."
- **Never post the same link twice within 30 days** (Memory between runs)
  Prompt: "Change my post queue automation so it remembers posted links and skips a row if the same link went out in the last 30 days."
- **A Monday email of what's queued for the week** (Schedules)
  Prompt: "Add to my post queue automation: every Monday at 8, email me the posts due this week."
- **Spread posts out so no more than two go out per day** (Multi-step logic)
  Prompt: "Change my post queue automation so it never publishes more than two posts on the same day, moving extras to the next free slot."

## Questions

### Can ChatGPT post to LinkedIn automatically?

With ClickRuntime connected, ChatGPT can set up an automation that posts to LinkedIn at set times through LinkedIn's API, using an account you connect in the ClickRuntime dashboard.

### Can it post to X?

Yes, through the X API with an X developer app that has write access. What you can post depends on your X API access.

### Do I have to write the posts?

You can, or the built-in AI can draft them into the sheet for you to approve first. See the Extend it list.

### Can it post images?

The networks' APIs support images with an extra upload step. Ask your assistant to add it; the image must be available at a public HTTPS link.

### What does it cost?

One run per check that publishes something. Checks that find nothing due finish quickly and aren't counted.
