Create formatted order rows from incoming order emails
Each order confirmation email becomes one tidy row in your orders sheet, with the customer, address and amount filled in and duplicates skipped.
Install it
Set up this Zap for me, read how here: https://zapier.sh/zapier/awesome-zaps/create-formatted-order-rows-from-incoming-order-emails/
Paste into Claude, ChatGPT, Cursor or any agent.
- Category
- Data & Analytics · Data operations
- Author
- Zapier
- Source
- zapier/awesome-zaps, folder zaps/create-formatted-order-rows-from-incoming-order-emails
Set it up with the CLI
- Add it. Copies the folder into
zaps/create-formatted-order-rows-from-incoming-order-emails/. Outside a project, it makes one first.npx zap-pack add awesome-zaps/create-formatted-order-rows-from-incoming-order-emails - Fill in the values in
config.ts, and in any other file the list marks. Replace each one as its comment and SKILL.md say. - Deploy it. Asks for any value still left, signs you in to Zapier if you aren't, then publishes it to your account.
npx zap-pack deploy create-formatted-order-rows-from-incoming-order-emails - Check it. Its recent runs, with status and errors.
npx zap-pack logs create-formatted-order-rows-from-incoming-order-emails
zaps/create-formatted-order-rows-from-incoming-order-emails/
- README.mdWhat it does, for people
- SKILL.mdHow an agent sets it up: what to ask you, and how to test it
- config.tsIts settings 1 to fill in
- connections/gmail.tsThe
gmailaccount it uses - connections/google-sheets.tsThe
google-sheetsaccount it uses - triggers/search.tsWhat starts it:
gmailsearch - workflow.tsThe code; each
ctx.stepis a step in the Zap
Agents: add --yes to any command so it never prompts. When it needs an answer only the user can give, it stops and names the flag that supplies it.
SKILL.md
View MarkdownWhat it does
- Trigger: a new Gmail email matching the search in
GMAIL_QUERY, by defaultsubject:"order confirmation" in:inbox(gmail,search). - Code: reads the order reference from the subject (
#<id>), falling back to anOrder number:line in the body. Skips the email if it mentions onboarding, course, registration or newsletter, or if it has no order reference and no total. - Code: reads the customer's name, email, phone, address lines, business and total from labelled lines in the body. Splits the name into first and last, turns
$,£or€intoUSD,GBPorEUR, and makes the amount a number. - Google Sheets looks up the order reference in the orders sheet. If a row already has it, the run stops and writes nothing.
- Google Sheets appends one row with the parsed fields, the sender's address in Source, and the time it was logged.
A row already in the sheet is never updated.
Ask the user
Each REPLACE_… value is set per person. Resolve names to IDs with the user's own connections; don't ask them to paste an ID you can look up.
| Setting | What goes there |
|---|---|
SPREADSHEET_ID |
The orders sheet: the long ID in its URL. Look it up from the sheet the user names |
Also review the defaults with them: GMAIL_QUERY (narrow it to the sender or subject their shop uses), WORKSHEET_ID ("0" is the first tab), and in workflow.ts, COLUMNS (the code writes thirteen columns, A to M, in that order; map their headers to those letters), EXCLUDE_PATTERN and CURRENCY_SYMBOLS.
Before turning it on, confirm:
- Which Gmail account receives the order confirmations, and does the default search match their subject or sender?
- What does a real order confirmation look like? The parser reads labels like
Order number:,Email:,Total:andAddress line 1:. If the email uses other labels, change them in the code before going live. - Is an order "paid" when it has a total, or do they need a payment-status check? The default counts any email with an order reference and a total.
Build it
If you can run shell commands, set it up with zap-pack: run npx zap-pack add awesome-zaps/create-formatted-order-rows-from-incoming-order-emails, replace each REPLACE_… value as this file says, then run npx zap-pack deploy create-formatted-order-rows-from-incoming-order-emails, which signs the user in to Zapier when it gets there. Otherwise build with Zapier MCP, as the steps below say. No Zapier MCP tools? Read https://docs.zapier.com/mcp/get-started/quickstart.md and follow the page for the app you are running in to get the user connected, then continue with this build.
- Accounts: bind
google-sheets(the Google account that owns the orders sheet) to the user's connection. The trigger usesgmail(the Gmail account that receives the order emails). The parsing code needs no connection. - Source: publish
workflow.tsandconfig.ts, with eachREPLACE_…replaced by the user's answer.triggers/search.tsandconnections/are settings, not code: set the workflow's trigger and connection bindings from them. The trigger file names the app by its slug; for the trigger'sselected_api, callsearch_triggerswith that slug, find the row whosekeyis the trigger'sevent, and use<app_key>@<app_version>from it. - Build guide: load Zapier's build guide with
get_zapier_skill("zapier:build-workflows")and follow it to create, test and publish the workflow. - Fields: inspect each action's fields with the user's connections and sample the trigger before the first test run, and fix any key in
workflow.tsthat doesn't match.
Test it
Run it once as a draft test with a test sheet as the orders sheet, so the row lands there, not in the real one:
{
"subject": "Order confirmation #IT-ORD-900001",
"body_plain": "Order number: IT-ORD-900001\nName: Pat Example\nEmail: pat@example.com\nPhone: 555-0100\nAddress line 1: 1 Test Street\nAddress line 2: Suite 2\nBusiness: example.com\nTotal: $1,250.00",
"from": { "name": "Test Shop", "email": "orders@example.com" },
"from__email": "orders@example.com"
}
Check that one row appears with the order ID, name split into first and last, phone, address lines, business, USD, the amount as 1250, the sender in Source and a logged-at time. Run the same sample again: it should finish with reason: "duplicate-order" and add no row. If run-status tools aren't available, check the result in Google Sheets directly. Then publish, confirm the trigger is active, and give the user the workflow's link. Ask the user to delete the test row, not the agent.
Notes
- The parser is simple: it reads labelled lines, not the whole email layout. Check it against a few real order emails before trusting it.
- Only the first matching row is checked for a duplicate.
- To alert billing staff on high-value orders, add a Slack or email step after the row is written, for amounts above a threshold. To tag rows by product type, add a column set from the subject or body.
- Don't commit a real spreadsheet ID. Anyone with access to the sheet can read the orders in it.