Clarion
Sign in Get started
Integration · Push URL via Apps Script

Send Google Sheets numbers to Clarion metrics automatically

If a number lives in a spreadsheet, a few lines of Apps Script can post it to Clarion on a timer, so the scorecard stops depending on someone copying it across.

A lot of scorecard numbers start life in a spreadsheet. Clarion has no Google Sheets add-on, but every Google Sheet comes with Apps Script, and Apps Script can call a Clarion push URL on a schedule. Once it’s set up, the sheet stays the place people work and Clarion stays current on its own.

How it works

A push URL is a private URL that belongs to one metric. Posting {"value": 1234} to it records 1234 for the metric’s current period — today, this week or this month — and replaces any earlier value for that period. A script that runs every hour therefore keeps one value per period up to date instead of piling up duplicates.

Set it up

  1. In Clarion, open the metric’s Edit Metric dialog and choose Create push URL. Copy the URL; it’s shown once.
  2. In the sheet, open Extensions → Apps Script and paste:
const PUSH_URL = "https://api.onclarion.com/v1/metrics/push/mpu_YOUR_TOKEN";

function pushToClarion() {
  const sheet = SpreadsheetApp.getActive().getSheetByName("Summary");
  const value = sheet.getRange("B2").getValue();

  const res = UrlFetchApp.fetch(PUSH_URL, {
    method: "post",
    contentType: "application/json",
    payload: JSON.stringify({ value: value }),
    muteHttpExceptions: true,
  });
  if (res.getResponseCode() !== 200) {
    throw new Error("Clarion said " + res.getResponseCode() + ": " + res.getContentText());
  }
}
  1. Run pushToClarion once from the editor and approve the permissions it asks for. Check the metric in Clarion.
  2. Open Triggers, add a trigger for pushToClarion, and choose a Time-driven schedule — hourly or daily is plenty.

A cell formatted as currency still holds a plain number, which is what getValue() returns. If you read display text instead, Clarion accepts "1,234" but refuses "$1,234" with a 400 rather than guessing.

To backfill, add a date to the payload — { value: 980, date: "2026-09-07" } — and it’s stored under that day, week or month.

Several metrics from one sheet

For a sheet that holds a whole scorecard, use one API key and the ingest endpoint rather than a push URL per metric. Create a key with the metrics:write scope and post an entries array, one entry per row:

const entries = rows.map(([name, value]) => ({ metric: name, value: value }));
UrlFetchApp.fetch(
  "https://api.onclarion.com/v1/companies/YOUR_COMPANY_ID/metrics/ingest",
  {
    method: "post",
    contentType: "application/json",
    headers: { "x-api-key": "clr_YOUR_KEY" },
    payload: JSON.stringify({ entries: entries }),
  },
);

Store the key in Project Settings → Script properties rather than in the code. The response reports each entry separately, including names that don’t match a metric. See Ingest metric values with the API.

Why not have Clarion read the sheet?

Clarion can fetch a metric from a URL on a schedule, but it reads JSON only. A published Sheet serves HTML or CSV, so Clarion can’t read it directly. Pushing from Apps Script is the reliable route.

Keep the push URL private — anyone with it can record values on that metric. If it leaks, choose Generate new URL and paste the new one into the script. For the habits that keep a scorecard trustworthy, see Keep your metrics current.

08 — Get started

Ready to build unstoppable momentum?

Join teams that are aligned, accountable, and growing — with a business operating system built to be lived in every day.

Get started free Book a demo
No credit card required · Set up in minutes