Skip to content

Every 15 minutes

Turn emailed orders into purchase orders in Airtable

Each order that arrives by email becomes a purchase order record in Airtable with the items and quantities listed.

Runs
Every 15 minutes
Apps
Airtable, Gmail
AI
Yes, uses the built-in AI allowance
Access
Gmail gmail.readonly; Airtable write

Send this to your assistant

Create a ClickRuntime automation: when a customer or supplier emails an order, extract the items and quantities and create a PO record in my Airtable 'Purchase orders' 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

A small wholesale bakery takes orders from cafes by email: "same as last week but 20 more croissants", a pasted table, a photo of a handwritten list. Every evening the manager reads the inbox, types each order into Airtable, and the kitchen plans the next day from that. A missed email means a cafe without bread.

Turning each order email into a structured record as it arrives keeps the order book current through the day. Wholesalers, workshops and small manufacturers use it to stop retyping orders and to plan production from an accurate list.

What you get out of it

  • Orders are logged as they arrive

    The order book is up to date at any moment, not only after someone has worked through the inbox.

  • Fewer missed or mistyped orders

    Items and quantities are copied from the email itself, which cuts the errors that come with retyping late in the day.

  • Production and purchasing plan from one list

    With every order in Airtable, it is easy to total quantities per product and see what to make or buy.

  • Customers can keep ordering by email

    Nobody has to learn a portal. They write the way they always have, and the order still ends up structured.

How it works

What happens, step by step

  1. Every few minutes ClickRuntime checks your Gmail for new order emails.

  2. It skips any email it has already turned into a purchase order.

  3. AI reads the email and lists each item with its quantity and any delivery date.

  4. A new purchase order record is created in your Airtable table.

Before it runs live

  • Connect Airtable
  • Connect Google through your own Google app (a one-time, 10-minute setup), so it works with your own Gmail

What you get

RunsEvery 15 minutes
Turn emailed orders into purchase orders in Airtabletoday, 9:00Succeeded
Airtable · Purchase ordersAcme Cafe | 60 x croissant, 24 x sourdough loaf | Deliver Friday 7am

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
  • Change what the AI looks for, or how it writes the result
  • Add another app, for example also send it to Slack
  • Combine it with other Airtable and Gmail 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.
purchase_orders_from_emails_into_airtable.pyexample
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from clickruntime import on_trigger, credentials, http, state, ai, report_fetched

BASE, TABLE = "appXXXXXXXX", "Purchase orders"
SCHEMA = {"type": "object", "properties": {"is_order": {"type": "boolean"}, "delivery_date": {"type": "string"},
          "items": {"type": "array", "items": {"type": "object", "properties": {"item": {"type": "string"}, "qty": {"type": "number"}}}}}}

@on_trigger
def run(event):
    gmail = build("gmail", "v1", credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False).users()
    seen = set(state.get("seen") or [])
    msgs = [m for m in gmail.messages().list(userId="me", q="subject:order newer_than:2d").execute().get("messages", []) if m["id"] not in seen]
    report_fetched(len(msgs))
    if not msgs:
        return {"summary": "Nothing new"}
    for m in msgs:
        msg = gmail.messages().get(userId="me", id=m["id"]).execute()
        sender = next(h["value"] for h in msg["payload"]["headers"] if h["name"] == "From")
        po = ai.generate(f"Extract the order lines from this email:\n{msg['snippet']}", json_schema=SCHEMA, max_output_tokens=400).json
        if po.get("is_order"):
            lines = "\n".join(f"{i['qty']} x {i['item']}" for i in po.get("items", []))
            http.post(f"https://api.airtable.com/v0/{BASE}/{TABLE}", headers={"Authorization": f"Bearer {credentials.secret('AIRTABLE_API_KEY')}"},
                      json={"fields": {"From": sender, "Items": lines, "Delivery date": po.get("delivery_date"), "Email ID": m["id"]}})
        seen.add(m["id"])
    state.set("seen", list(seen)[-1000:])
    return {"checked": len(msgs)}

FAQ

Common questions

What does each purchase order record contain?
The customer or supplier, the date, each item with its quantity, any requested delivery date, and a link back to the original email.
What if an email is not an order?
Emails that do not contain an order, such as questions or invoices, are skipped and no record is created.
Can it handle orders with many lines?
Yes. Each item and quantity is listed in the record, and long orders are captured in full.
What permissions does it need?
Gmail gmail.readonly; Airtable write. Nothing else in your accounts is used.
Does it need AI?
Yes. It uses ClickRuntime's built-in AI, so you don't need an OpenAI or Anthropic key. Every plan includes a monthly 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 emailed orders into purchase orders in Airtable” from your assistant

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