Skip to content

External data connections

The data behind a document usually already lives somewhere: a spreadsheet the finance team maintains, a Notion database the account managers keep current. Copying it into a second place creates a second version of the truth, and the one on the document is always the older one.

Compose PDF reads the source instead. Two directions are available, and which one fits depends on whether the source can be reached from outside.

Connect Google Sheets or Notion under Settings → Connections, then link a table in your template to a sheet or database. From that point the table follows the source: it becomes read-only in the studio, shows where it comes from, and is read again each time a document is rendered. Refresh now pulls it immediately while you are designing.

No copy is kept. The rows are fetched when they are needed and are not stored afterwards, which is the point — there is nothing to go stale, and nothing to purge when a customer leaves.

The connection is authorized separately from signing in. Signing in with Google grants nothing to your spreadsheets; connecting a data source is its own consent, visible in the connections list with who added it and when, and revocable there. Only owners and admins can add or remove connections.

A spreadsheet with customer names in it is usually one nobody wants to make link-readable, and the pull direction needs read access. So invert it: a small Apps Script runs inside your own Google account, reads the private sheet with your own authorization, and pushes the rows to Compose PDF. No sharing setting changes, and no Google credential is given to us.

The studio generates the script for you, with the steps to install it. It sends rows to one endpoint, the only write on the public API:

Terminal window
curl -X PUT https://composepdf.com/v1/datasets/{datasetId}/rows \
-H "x-api-key: $COMPOSEPDF_PUSH_KEY" \
-H "content-type: application/json" \
-d '{ "path": "items", "rows": [ … ] }'

Create a “Push data” key for this under Settings → API keys — an API key that can write datasets and nothing else. It cannot render, so the credential sitting inside a spreadsheet cannot be used to pull documents back out. Every write is recorded with the key that made it.

path names the list the rows replace — the array your table is bound to — so two sheets can feed two different lists in the same document without overwriting each other.

If the data does not need to stay connected, import a CSV or a spreadsheet once. That makes a copy you can edit in the studio like any other data.

  • Plan-gated. Free holds no connections; Solo holds one; Team and above are unlimited. See pricing.
  • Providers. Google Sheets and Notion.
  • A linked table cannot also be pushed to. It follows one source; a write to it is refused rather than silently applied and then overwritten on the next render.
  • If the source cannot be reached at render time, the render fails with a clear error rather than falling back to older rows.
  • A sheet’s first row is its header, and a sheet with no rows under the header is an error rather than an empty document.