# Google Sheets to every connected network: n8n cross-posting template

This n8n workflow sends one approved Google Sheets row to every network named in its networks column through a single PubNio request, then writes one outcome line per destination. Tick retry_failed and the next run retries only deliveries PubNio marks retryable, naming the attempt it replaces, so nothing that may already be live is resent.

Download: <https://pubnio.com/templates/n8n/google-sheets-to-all.json> (n8n workflow JSON, no credentials inside). Checked on n8n 2.50.7. Destination: every connected network.

## What it does

- **Trigger.** A Schedule Trigger every 15 minutes reads every row of one sheet.
- **Approval.** Tick approved to send the row; tick retry_failed later to retry failed destinations.
- **Request.** One create request per approved item. Each create carries the item's saved key as `Idempotency-Key`, and every request sends `PubNio-Version: 2026-12-02`.
- **Result.** The answer is written back to the item; the next runs read the post's status until every destination settles.

## Fields: Sheet columns

| Field | Type | Use |
| --- | --- | --- |
| `id` | text | Unique per row; seeds the idempotency key. |
| `approved` | checkbox | TRUE sends the row. |
| `text` | text | The post text for every network. |
| `image_url` | URL | Optional public HTTPS image. |
| `networks` | text | Network IDs separated by commas or spaces, e.g. `instagram, linkedin, x`. |
| `retry_failed` | checkbox | TRUE retries retryable failed destinations once; the workflow clears it. |

The workflow also fills `pubnio_key`, `pubnio_post_id`, `pubnio_status`, `pubnio_outcome`, `pubnio_error`, `pubnio_sent_at`; create them as text fields.

## Set up

1. **Create a PubNio API key.** In PubNio, create an API key with the publish scope; it includes read, which the status checks use.
2. **Import the workflow.** Download the JSON and import it into n8n with Import from File. It is checked on n8n 2.50.7.
3. **Add the PubNio credential.** Create a Header Auth credential named PubNio API key with name Authorization and value Bearer followed by the key. Select it on **Create post in PubNio**, **Read post status**, **Import media**, **Read media status**, **Read post before retry**, **Retry delivery**.
4. **Fill PubNio settings.** Open the PubNio settings node and set `workspaceId`.
5. **Connect Google Sheets.** Add the sheet columns above and the pubnio_ text fields, then select your Google Sheets credential and the same spreadsheet and sheet on **Read rows**, **Save key before sending**, **Write result to row**.
6. **Run one approved test item.** Approve one test item, run the workflow once, and read pubnio_status and pubnio_outcome. Then activate it.

## Request

One request, one post, one delivery per network. The row's status rolls up the deliveries: active work first, then unresolved, failed, published. PubNio does not post this network's media from a URL, so the workflow first has PubNio import image_url, waits for the import to be ready, and sends the media ID it returns.

```json
{
  "text": "We are hiring two engineers. Apply by Friday.",
  "platforms": [
    "instagram",
    "linkedin",
    "x"
  ],
  "media": [
    {
      "mediaId": "aaaaaaaa-1111-4aaa-8aaa-aaaaaaaaaaaa"
    }
  ]
}
```

## Tested behavior

The download is imported unchanged into a clean n8n 2.50.7 container, and its node types, versions, parameters, and operations are checked against that release. Then a copy runs with n8n execute. Its PubNio requests and its Code, If, Switch, and Merge nodes run as published. Its trigger and source nodes are simulated by a fake source with the same row shapes, its media wait is cut to one second, and PubNio is a fake API that decodes every request with PubNio's own schemas and checks it with PubNio's own content rules. PubNio's test suite replays every create and validate request the run sent against the real API and requires the same answer. It proves:

- Only approved items are sent to PubNio.
- The key is a hash of the stable row ID, saved on the row with its send time before the request that sends it.
- A lost response (503 after PubNio admitted the post) is resent with the same key and PubNio returns the first post.
- A key with no post ID that was sent 23 hours and 1 minute ago, or has no send time, stops at needs_review instead of being resent.
- A 202 is recorded as queued or scheduled, never as published, until a delivery reports it.
- `Instagram, linkedin x` becomes `platforms: ["instagram", "linkedin", "x"]` and the row gets one outcome line per destination.
- With LinkedIn failed and retryable, retry_failed sends one retry request for the LinkedIn target only, with `expectedAttemptId`; the results merge into one write that records `queued` and clears the checkbox.
- image_url is imported and sent as `media[0].mediaId`; a row for Instagram without an image is rejected with `media_required at targets.0.media`, then accepted once image_url is filled.

## Recovery

- **When one destination `failed` and pubnio_outcome shows a next action:** Fix the cause, then tick retry_failed. Destinations PubNio does not mark `canRetry` are left alone and reported.
- **When a destination is `unresolved`:** PubNio could not confirm whether it posted, so it is never retried. Check the network, then reconcile it in PubNio.
- **When pubnio_error starts `Media import failed`:** PubNio could not fetch image_url. Point it at a public HTTPS file, clear pubnio_status, and the next run imports it again.
- **When pubnio_status is `media_processing`:** Nothing to do: PubNio is still importing the file, and the next run checks the same import again.

## Limits

- Same text and image everywhere; per-network text needs a `targets` body.
- Each network needs exactly one connected account in the workspace.
- PubNio has no approval step of its own; approval happens in Google Sheets before n8n calls PubNio.
- The check uses a fake PubNio and fake provider answers, so this page shows no real delivery.

## Related

- [n8n integration: every PubNio template](https://pubnio.com/integrations/n8n)
- [Google Sheets to Instagram: n8n template with row approval](https://pubnio.com/templates/n8n/google-sheets-to-instagram)
- [Google Sheets to YouTube: n8n upload template with approval](https://pubnio.com/templates/n8n/google-sheets-to-youtube)
- [PubNio quickstart](https://pubnio.com/docs/quickstart/)

