Create PO records from new purchase orders
When a purchase order PDF lands in your OneDrive folder, its company and PO number are read and logged as one row in your PO table, with a link back to the file.
Install it
Set up this Zap for me, read how here: https://zapier.sh/zapier/awesome-zaps/create-po-records-from-new-purchase-order-pd-fs/
Paste into Claude, ChatGPT, Cursor or any agent.
- Category
- Finance · Procure to pay
- Author
- Zapier
- Source
- zapier/awesome-zaps, folder zaps/create-po-records-from-new-purchase-order-pd-fs
Set it up with the CLI
- Add it. Copies the folder into
zaps/create-po-records-from-new-purchase-order-pd-fs/. Outside a project, it makes one first.npx zap-pack add awesome-zaps/create-po-records-from-new-purchase-order-pd-fs - 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-po-records-from-new-purchase-order-pd-fs - Check it. Its recent runs, with status and errors.
npx zap-pack logs create-po-records-from-new-purchase-order-pd-fs
zaps/create-po-records-from-new-purchase-order-pd-fs/
- 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 5 to fill in
- connections/chatgpt.tsThe
chatgptaccount it uses - connections/onedrive.tsThe
onedriveaccount it uses - connections/pdf4me.tsThe
pdf4meaccount it uses - connections/zapier-tables.tsThe
zapier-tablesaccount it uses - triggers/new-or-updated-file.tsWhat starts it:
onedrivenew_or_updated_file - 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 file is created or changed in the chosen OneDrive folder (
onedrive,new_or_updated_file). The trigger brings the file's name, download link and date. - PDF4me (
pdf4me) extracts the text of the PDF, page by page. - ChatGPT (
chatgpt) reads that text and returns the company name and PO number. Missing values come back asNot Found. - Filter: the run stops if there is no PO number (or it is
Not Found). - Zapier Tables (
zapier-tables) looks for an existing record with the same PO number. If one exists, the run stops, so a PO already logged is skipped, never overwritten. - Zapier Tables creates a record with the file's date, a link to the file, the company and the PO number.
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 | Where | What goes there |
|---|---|---|
REPLACE_PO_TABLE_ID |
config.ts |
The Zapier Table that holds the PO register |
REPLACE_DATE_FIELD |
config.ts |
The table field key that gets the file's date |
REPLACE_ATTACHMENT_FIELD |
config.ts |
The table field key that gets the link to the file |
REPLACE_COMPANY_FIELD |
config.ts |
The table field key that gets the company name |
REPLACE_PO_NUMBER_FIELD |
config.ts |
The table field key that gets the PO number |
Also ask:
- Which OneDrive folder holds the purchase orders? Set it as the trigger's folder; blank watches the root.
- Should PO numbers match exactly, or ignoring case and spaces? The workflow matches the PO number as extracted, so ignoring case and spaces needs a code change.
- Connect PDF4me, ChatGPT (OpenAI) and OneDrive in the user's account. The Zap can't run without all three.
Review the default NOT_FOUND ("Not Found") with them. It is the value the prompt writes for a missing field, so keep it unless the prompt changes.
Build it
If you can run shell commands, set it up with zap-pack: run npx zap-pack add awesome-zaps/create-po-records-from-new-purchase-order-pd-fs, replace each REPLACE_… value as this file says, then run npx zap-pack deploy create-po-records-from-new-purchase-order-pd-fs, 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
pdf4me(PDF4me, for the text extraction),chatgpt(ChatGPT, for reading the PO fields), andzapier-tables(the Zapier Tables account that holds the PO register) to the user's connections. Bindonedriveto the user's OneDrive connection for the trigger. Every app here needs a connection. - Source: publish
workflow.tsandconfig.ts, with eachREPLACE_…replaced by the user's answer.triggers/new-or-updated-file.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 one-page PDF in a folder the user owns. Its text should contain a company name and a PO number, such as Northwind Traders and PO-2026-0412.
Check that:
- The run finds no existing record for that PO number, and creates one.
- The new record has the file's date, a link to the file, the company and the PO number.
- A second run with the same file skips with
duplicate-po. - A PDF with no PO number skips with
po-number-not-found, and writes nothing.
If run-status tools aren't available, check the result in Zapier Tables directly. Then publish, confirm the trigger is active, and tell the user where to put their PO files. The user deletes the test records and the test file, not the agent.
Notes
- Zapier Tables field keys are set by the table. Check them against the table before the first run, since a wrong key writes to the wrong column.
- The ChatGPT step returns text; the code reads it as JSON with keys
companyandpo_number. If the model returns other text, both values becomeNot Found. - A re-saved PO fires the trigger again, and the duplicate check skips it.
- To extend it: send a Slack or email message for human review when a duplicate PO is found, or add a check for other placeholder values beyond
Not Found.