Skip to content

Sync a CMS collection from Google Sheets

Fill a collection with the rows of a Google Sheet, kept up to date on a schedule or when you sync, with nothing ever written to your sheet.

2 min readENFRNLDE
On this page 2 sections

Before you start

A CMS collection can take its items from a tab of a Google Sheet: a price list, a team, a list of events. Each row becomes an item. The rows are copied from your Google account into our storage in the EU when the collection syncs, so your site never loads anything from Google when someone visits it, and nothing is ever written to your sheet.

Before you start

The sheet is read with a service account of your own Google Cloud project. Xeek Sites only asks Google for read access:

  1. In your Google Cloud project, turn on the Google Sheets API.
  2. Create a service account, and add a JSON key to it. Keep the key file: you paste its whole contents in the next step.
  3. In Google Sheets, share the spreadsheet with the service account's address, as you would with a person.

The first row of the tab must name the columns: those names are what you map to fields.

Connect the sheet

  1. Open the collection. In its toolbar, choose Sync from…, then Google Sheets.
  2. In Service account key (JSON), paste the whole key. It is stored encrypted.
  3. In Spreadsheet link, paste the spreadsheet's link, or its ID.
  4. In Tab, enter the name of the tab, exactly as it is in the sheet.
  5. Choose Read the columns. The sheet is read once, and each column gets a line with a few of its values and a suggested type, from its first 50 rows.
  6. In Key column, choose the column whose value is each row's own and never changes, such as an ID or a product number. It ties a row to its item, so a changed row updates its item. A row with nothing in that column (an empty row, a total under the table) is skipped. The first column is chosen to begin with.
  7. Choose how often to Sync: Only when I sync, Every hour or Every day (the default). Publish new items at once is on: new items are published as they arrive. Turn it off to review new items before you publish them.
  8. Choose what happens When a row is deleted from the sheet: Archive its item (the default), Delete its item or Keep its item.
  9. Choose Connect and sync. The new fields are made, and the first sync starts at once.

If the collection already holds items from an earlier source, and the new source may not have them, the dialog first says how many: “Up to 12 items synced from an earlier source will be archived if the new source doesn’t have them.” It says “deleted” for Delete its item and asks nothing for Keep its item. Choose Cancel, or Connect anyway. Nothing is removed before you choose.