Skip to content

On a schedule

Turn order rows in a sheet into Stripe invoices

Each new B2B order in your sheet becomes a finalised Stripe invoice, with the invoice link written back to the row.

Runs
On a schedule
Apps
Google Sheets, Stripe
AI
Not needed
Access
Stripe write customers/invoices; sheet editor

Send this to your assistant

Create a ClickRuntime automation: every hour, create a Stripe invoice for each new B2B order row in my sheet that has no invoice yet and write the invoice link back to the row.

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

A wholesale bakery takes trade orders from cafés by phone and email, and the sales assistant records each one as a row in a shared Google Sheet. Invoicing is a separate weekly job: open Stripe, find or create the customer, add the items, send the invoice, copy the link back. Orders taken on Monday are invoiced on Friday, and cash comes in a week later than it could.

This automation turns the sheet into the invoicing tool. Every hour it picks up rows without an invoice, finds or creates the customer in Stripe, builds and finalises the invoice and writes the link back into the row. The team keeps working in the sheet they know, and every order is invoiced within the hour.

What you get out of it

  • Invoices go out the same day

    Orders are invoiced within an hour of being added, so customers can pay sooner.

  • The team keeps using the sheet

    Nobody has to learn Stripe; adding a row is all it takes.

  • The sheet shows what's been invoiced

    The invoice link is written into each row, so it is clear which orders are done.

  • Customers are reused

    Existing Stripe customers are found by email, so repeat buyers are not duplicated.

  • No double invoices

    Rows that already have a link are skipped, so each order is invoiced once.

How it works

What happens, step by step

  1. Every hour, ClickRuntime reads your orders sheet and picks out rows that have no invoice link yet, stopping straight away if there are none.

  2. For each order, it finds the customer in Stripe by email, or adds them if they are new.

  3. It adds the order's item, quantity and price to a new invoice and finalises it.

  4. The invoice link is written back into the row, so the order is never invoiced twice.

Before it runs live

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

What you get

RunsOn a schedule
Turn order rows in a sheet into Stripe invoicestoday, 9:00Succeeded
Google Sheets · OrdersRow 48, Northwind Café, 120 x sourdough loaves @ 3.20 GBP. Invoice link added: https://invoice.stripe.com/i/acct_ex/inv_ex

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

  • Act only on the items that match your own rules, and skip the rest
  • 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 Stripe 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.
create_stripe_invoices_from_sheet_orders.pyexample
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
import stripe
from clickruntime import on_trigger, credentials, report_fetched

SHEET_ID = "your-sheet-id"

@on_trigger
def run(event):
    sheets = build("sheets", "v4", credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False).spreadsheets()
    rows = sheets.values().get(spreadsheetId=SHEET_ID, range="Orders!A2:G").execute().get("values", [])
    todo = [(i + 2, r) for i, r in enumerate(rows) if len(r) >= 6 and (len(r) < 7 or not r[6])]
    report_fetched(len(todo))
    if not todo:
        return {"invoiced": 0}
    stripe.api_key = credentials.secret("STRIPE_API_KEY")
    for row_no, (email, company, item, qty, price, currency, *_) in todo:
        found = stripe.Customer.list(email=email, limit=1).data
        customer = found[0] if found else stripe.Customer.create(email=email, name=company)
        inv = stripe.Invoice.create(customer=customer.id, collection_method="send_invoice", days_until_due=30, currency=currency.lower())
        stripe.InvoiceItem.create(customer=customer.id, invoice=inv.id, description=item, quantity=int(qty),
                                  unit_amount=round(float(price) * 100), currency=currency.lower())
        inv = stripe.Invoice.finalize_invoice(inv.id)
        sheets.values().update(spreadsheetId=SHEET_ID, range=f"Orders!G{row_no}", valueInputOption="RAW",
                               body={"values": [[inv.hosted_invoice_url]]}).execute()
    return {"invoiced": len(todo)}

FAQ

Common questions

What columns does the sheet need?
Customer email, company name, item description, quantity, unit price and currency, plus an empty column for the invoice link. Your AI assistant can set it up to match your existing columns.
Are invoices sent to the customer?
They are finalised in Stripe, which gives them a payment link. If you have Stripe's invoice emails switched on, the customer is emailed too.
What are the payment terms?
Invoices are due 30 days after they are created by default. You can choose a different number of days.
What permissions does it need?
Stripe write customers/invoices; sheet editor. 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 checks. Checks that find nothing new 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 “Turn order rows in a sheet into Stripe invoices” from your assistant

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