使用 Make 和 OpenAI 自動提取採購訂單資料至 Google Sheets 的教學
Extract Purchase Order Data to Google Sheets with Make and OpenAI
Make 配合 Gmail、OpenAI 和 Google Sheets,可自動讀取電郵中的採購訂單 PDF,提取訂單欄位並記錄到試算表,免去手動輸入。示範流程使用虛構訂單,按每項貨品各記一行,合計為 $4,750.00。掃描不清的 PDF 可能令數字辨識錯誤,使用前應核對資料。
Every week a purchase order lands in your inbox as a PDF, and someone types the PO number and total into a sheet by hand. Learn how to extract purchase order data to google sheets automatically — Gmail catches the weekly purchase order PDF, OpenAI reads the PO number, vendor, line items, total, and due date off the document, and Google Sheets logs the row so nobody types purchase order details by hand again.
This is the companion tutorial for the StackScale video above. No code, no live orders, and no real vendor data — the whole flow runs on one fictional demo purchase order (PO-2026-1147, Northwind Office Supplies) so you can test it safely.
What You Will Build
A Make scenario that watches Gmail for a purchase order PDF, sends it to OpenAI to extract the fields, and logs one row per line item in Google Sheets: PO number, vendor, line item, quantity, unit price, total, and due date. The demo order reads 12 ergonomic chairs × $250.00 = $3,000.00 and 25 monitor arms × $70.00 = $1,750.00, due 10 December 2026 — and the arithmetic checks out: $3,000.00 + $1,750.00 = $4,750.00.
Prerequisites / Tools
- A Make account (free plan is enough to start)
- A Gmail inbox where purchase orders arrive
- An OpenAI key for the extraction step
- A Google Sheet with seven columns: PO number, vendor, line item, quantity, unit price, total, and due date
Disclosure: Some links below are affiliate links, meaning StackScale may earn a commission at no extra cost to you.
- Make: https://www.make.com/en/register?pc=stackscale&affiliateSource=devto
- Gmail: https://mail.google.com
- OpenAI: https://openai.com
- Google Sheets: https://sheets.google.com
The Workflow
Gmail watches for new messages with a PDF attachment. When a purchase order arrives, the scenario starts itself, OpenAI reads the document and returns the five fields as structured data, and Google Sheets logs the row. No typing, no copying, no mis-keyed totals.
Step 1: Catch the PO in Gmail
In Make, add the Gmail module and set it to watch for new messages with a PDF attachment (demo file: po-2026-1147.pdf). When a purchase order arrives, the scenario starts itself.
Step 2: Let OpenAI extract the PO fields
Add an OpenAI module and send it the PDF with one prompt:
Return the PO number, vendor, line items, total, and due date from this purchase order as structured fields.
It returns the order — PO-2026-1147, Northwind Office Supplies, 12 ergonomic chairs at $250.00, 25 monitor arms at $70.00, total $4,750.00, due 10 December 2026.
Step 3: Map each field to its Sheets column
Add a Google Sheets module (Add a Row) and map each extracted field to its column:
{
"po_number": "{{2.po_number}}",
"vendor": "{{2.vendor}}",
"line_items": "{{2.line_items}}",
"total": "{{2.total}}",
"due_date": "{{2.due_date}}"
}
Demo values: PO number PO-2026-1147, vendor Northwind Office Supplies, line items 12 ergonomic chairs × $250.00 = $3,000.00 and 25 monitor arms × $70.00 = $1,750.00, total $4,750.00, due date 10 December 2026. One line item per row, so the sheet stays searchable.
Finished Sheet rows (demo):
PO-2026-1147 | Northwind Office Supplies | 12 ergonomic chairs | 12 | $3,000.00
PO-2026-1147 | Northwind Office Supplies | 25 monitor arms | 25 | $1,750.00
Step 4: Test it with the dummy PO
Run the scenario once on the fictional demo order and check the line items add up: $3,000.00 + $1,750.00 = $4,750.00. If the total does not match, check the extraction prompt first.
One honest limit
OpenAI reads the purchase order as written, so if the PDF is a scanned image with smudged print, the extraction can misread a digit — always glance at the row before you rely on it. This logs purchase orders; it is not a procurement system.
If you still type purchase order details by hand, watch the video above, subscribe to StackScale for a new tutorial every day, and comment PO if your POs are still waiting.
來源:DEV Community · dev.to