Skip to content

On a schedule

Keep a Supabase knowledge base in sync with your FAQ sheet

Each night, new or edited rows in your FAQ sheet are turned into search-ready entries in your Supabase documents table, so your bots always answer from the latest version.

Runs
On a schedule
Apps
Google Sheets, Supabase
AI
Not needed
Access
sheet read; Supabase write

Send this to your assistant

Create a ClickRuntime automation: every night, embed new or changed rows from my FAQ Google Sheet and upsert them into my Supabase documents table.

Paste it into your assistant. It tells you what it will send or change before it runs live.

First time? Adding ClickRuntime to your assistant takes about two minutes.

Why use it

Why teams use this automation

The support team keeps the official answers in a Google Sheet because everyone can edit it. The chatbot, though, reads from Supabase, and someone has to remember to re-import the sheet after every change. Usually they don't, and the bot gives last quarter's answers.

Syncing only the rows that changed each night keeps the bot's knowledge in step with the sheet, while the team carries on editing where they're comfortable.

What you get out of it

  • Bots answer from the latest version

    Edits in the sheet reach the knowledge base overnight.

  • Edit where the team already works

    Support staff keep using the sheet; nobody touches the database.

  • Only changes are processed

    Unchanged rows are skipped, which keeps the nightly run fast and cheap.

  • One source of truth

    The sheet stays the official list of answers.

How it works

What happens, step by step

  1. Every night, ClickRuntime reads the questions and answers from your FAQ sheet.

  2. It compares each row with a fingerprint saved from the last run to find new or edited rows.

  3. It turns each changed row into a search-ready entry using an embedding service.

  4. It adds or updates those entries in your Supabase documents table.

Before it runs live

  • Connect your Google Sheets account and pick the spreadsheets it may use
  • Connect Supabase

What you get

RunsOn a schedule
Keep a Supabase knowledge base in sync with your FAQ sheettoday, 9:00Succeeded
Supabase · documentsfaq-14 · Q: Can I pause my plan? A: Yes, from Settings → Billing for up to 3 months.

Build your own

Need it to work differently?

This template is a starting point. Copy the prompt and change it, or describe a different automation from scratch, with your own conditions, more apps or an AI step. Your assistant writes it, tests it and runs it on ClickRuntime.
  • Your own rules

    Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.

  • Any number of apps

    One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.

  • AI where it helps

    Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.

  • On a schedule or on each event

    Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.

Changes you can ask for

  • Run it at a different time, more or less often, or only on weekdays
  • Add an AI step, for example to summarize, sort or draft a reply
  • Add another app, for example also send it to Slack
  • Combine it with other Google Sheets and Supabase steps into one automation

Under the hood

The code that runs this automation

This is the Python script that runs each time the automation starts. Your AI assistant writes it for you when you send the prompt, and you allow each step in your assistant. To change how the automation works, describe the change to your assistant and it updates the script for you. For every function it can use, see the script reference.
turn_a_faq_sheet_into_a_supabase_knowledge_base.pyexample
import hashlib
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from clickruntime import on_trigger, credentials, http, state, report_fetched

SHEET_ID = "your-spreadsheet-id"
SUPABASE = "https://your-project.supabase.co/rest/v1"

def sb(method, path, **kw):
    key = credentials.secret("SUPABASE_KEY")
    r = http.request(method, f"{SUPABASE}/{path}", **kw, headers={"apikey": key, "Authorization": f"Bearer {key}", "Prefer": "return=representation,resolution=merge-duplicates"})
    return r.raise_for_status() or (r.json() if r.content else None)

@on_trigger
def run(event):
    rows = build("sheets", "v4", credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False).spreadsheets().values().get(spreadsheetId=SHEET_ID, range="FAQ!A2:B").execute().get("values", [])
    seen = state.get("hashes") or {}
    changed = []
    for i, r in enumerate(rows, start=2):
        if len(r) == 2 and seen.get(str(i)) != (h := hashlib.sha256("\n".join(r).encode()).hexdigest()):
            changed.append((i, r, h))
    report_fetched(len(changed))
    if not changed:
        return {"summary": "Nothing new"}
    texts = [f"Q: {q}\nA: {a}" for _, (q, a), _ in changed]
    emb = http.post("https://api.openai.com/v1/embeddings", headers={"Authorization": "Bearer " + credentials.secret("OPENAI_API_KEY")},
                    json={"model": "text-embedding-3-small", "input": texts}).json()["data"]
    sb("POST", "documents?on_conflict=id", json=[{"id": f"faq-{i}", "content": t, "embedding": e["embedding"]} for (i, _, _), t, e in zip(changed, texts, emb)])
    seen.update({str(i): h for i, _, h in changed})
    state.set("hashes", seen)
    return {"synced": len(changed)}

FAQ

Common questions

What does embedding mean here?
Each question and answer is turned into a list of numbers that lets Supabase find it by meaning, not just exact words. This uses an embedding service with its own API key.
How are changes detected?
A fingerprint of each row is kept between runs; rows whose fingerprint changes are sent again.
What happens to deleted rows?
By default they stay in Supabase. Ask for rows missing from the sheet to be removed too.
What permissions does it need?
sheet read; Supabase write. Nothing else in your accounts is used.
Does it need AI?
No. It runs without AI, so it doesn't use your plan's AI allowance.
How many runs does it use?
One run each time it runs (on a schedule). Checks that find nothing to do and stop right away aren't counted.
Can I change how it works?
Yes. Describe the change to your AI assistant, for example a different schedule, channel or filter. It updates the automation, tests it and tells you what changed.

Set up “Keep a Supabase knowledge base in sync with your FAQ sheet” from your assistant

Copy the prompt above, or connect your assistant first. Free plan, no credit card.