Skip to content

Daily

List low-stock items from Supabase in a purchasing sheet

Each night, items in your Supabase inventory that are below their reorder level are written to your purchasing sheet, and you get an email to review and approve them.

Runs
Daily
Apps
Google Sheets, Supabase
AI
Not needed
Access
Supabase read+write; sheet edit

Send this to your assistant

Create a ClickRuntime automation: each night, read stock levels from my Supabase inventory table, write items below their reorder level to my Purchasing sheet with a suggested order quantity, and email me to approve.

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

An ecommerce brand tracks stock in its own Supabase-backed system, but purchasing is done by an ops manager who lives in spreadsheets. Every week they export the table, filter low items and work out quantities by hand.

A nightly purchasing sheet, already filtered and with suggested quantities, gives the ops manager a ready list to approve each morning.

What you get out of it

  • A ready purchasing list each morning

    Low items, current stock and suggested quantities are waiting in the sheet.

  • Approval stays with a person

    Nothing is ordered automatically; the email asks you to review.

  • No exports

    The sheet is refreshed from the live table every night.

  • Fewer stock-outs

    Items are flagged as soon as they cross their reorder level.

How it works

What happens, step by step

  1. Each night, ClickRuntime reads every active item from your Supabase inventory table.

  2. It picks out items whose stock is below their reorder level and works out a suggested order quantity.

  3. It replaces the Purchasing tab in your sheet with the current list.

  4. If anything is low, you get an email asking you to review and approve the list.

Before it runs live

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

What you get

RunsDaily
List low-stock items from Supabase in a purchasing sheettoday, 9:00Succeeded
Email · Reorder review3 items to reorder – Northwind Mug: 6 in stock, order 34 · Acme Tote: 9 in stock, order 21

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.
inventory_tracking_with_approvals.pyexample
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from clickruntime import on_trigger, credentials, http, notify

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):
    items = sb("GET", "inventory?active=is.true&select=sku,name,quantity,reorder_level,target_level")
    low = [i for i in items if i["quantity"] < i["reorder_level"]]
    rows = [["SKU", "Item", "In stock", "Reorder level", "Suggested order", "Approved?"]]
    rows += [[i["sku"], i["name"], i["quantity"], i["reorder_level"], (i.get("target_level") or 2 * i["reorder_level"]) - i["quantity"], ""] for i in low]
    sheets = build("sheets", "v4", credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False).spreadsheets()
    sheets.values().clear(spreadsheetId=SHEET_ID, range="Purchasing!A:F").execute()
    sheets.values().update(spreadsheetId=SHEET_ID, range="Purchasing!A1", valueInputOption="RAW", body={"values": rows}).execute()
    if low:
        notify.email_me(f"{len(low)} items to reorder – please review", "\n".join(f"{r[1]}: {r[2]} in stock, order {r[4]}" for r in rows[1:])
                        + f"\n\nApprove in the sheet: https://docs.google.com/spreadsheets/d/{SHEET_ID}")
    return {"low": len(low)}

FAQ

Common questions

How is the order quantity suggested?
As the item's reorder quantity from your table, or enough to reach its target stock level if you store one.
Does the sheet keep old lists?
Each night the Purchasing tab is replaced with the current list. Ask for a dated tab per night if you want history.
Which items are included?
Active items where quantity is below the reorder level.
What permissions does it need?
Supabase read+write; sheet edit. 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 (daily). 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 “List low-stock items from Supabase in a purchasing sheet” from your assistant

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