n8n

How to Automate Gmail to Sheets Order Capture?

Turn purchase order emails into clean rows in a Google Sheet. Ideal for operations and warehouse teams that receive inbound order emails and need fast, accurate data entry without manual typing.

A Gmail trigger watches for new emails and an If check looks for the words Inbound Order in the subject. The email subject and body go to an AI Agent that uses an OpenAI chat model with a structured output parser to pull the purchase order number, the expected delivery date, and each order line with SKU and quantity. A Code node reshapes the AI result into rows. The Google Sheets node appends those rows into a sheet with the columns PO_NUMBER, EXPECTED_DELIVERY DATE, SKU_ID, and QUANTITY. Because it uses structured parsing, it works even if the email text is not in a strict template.

Set up Gmail, Google Sheets, and OpenAI credentials in n8n Cloud, then paste your sheet details and review the system prompt to match your email style. Expect data entry to drop from about 30 minutes per order to a few minutes, with far fewer mistakes. Great for suppliers, 3PL teams, and retail operations that track inbound stock from email.

What are the key features?

  • Gmail trigger polls every minute to catch new emails quickly.
  • If node filters emails by subject to process only inbound orders.
  • AI Agent uses an OpenAI Chat Model and a structured parser to extract the purchase order, date, SKUs, and quantities.
  • Code node converts the AI output into one row per order line.
  • Google Sheets node appends rows to a selected sheet with mapped columns.
  • Sample email content included for easy end to end testing.

What are the benefits?

  • Reduce manual data entry from 30 minutes to 2 minutes per purchase order
  • Improve data accuracy by up to 90 percent by removing copy paste errors
  • Handle 5 to 10 times more orders without adding staff
  • Connect Gmail and Google Sheets so order data is ready for reporting
  • Standardize dates and SKUs for easier downstream processing

How do you set it up?

  1. Import the template into n8n: Create a new workflow in n8n > Click the three dots menu > Select 'Import from File' > Choose the downloaded JSON file.
  2. You'll need accounts with Gmail, Google Sheets and OpenAI. See the Tools Required section above for links to create accounts with these services.
  3. In the n8n credentials manager, open the Gmail Trigger node and create a new Gmail credential. Click Create new credential, then follow the on screen steps to grant access to your mailbox.
  4. In the Gmail Trigger settings, keep the polling interval as every minute. Leave other filters blank and rely on the If node for subject filtering.
  5. Open the If node named Is PO and set the condition to Subject contains Inbound Order. Keep case sensitive if your subject format is consistent.
  6. Open the OpenAI Chat Model node. Click Create new credential, paste your OpenAI API key from your OpenAI account API page, and save. Choose the model GPT 4o mini.
  7. Open the AI Agent node. Review and edit the system message so it matches your email style and supplier names. Ensure it asks for purchase order, expected delivery date, SKU, and quantity.
  8. Open the Structured Output Parser node. Confirm the schema includes purchase_order, expected_delivery_date, and a lines array with sku and quantity. Use YYYY MM DD for the date.
  9. Open the Google Sheets node. Click Create new credential and connect your Google account. Select your spreadsheet by URL or ID and choose the correct sheet tab.
  10. In your Google Sheet, create columns named PO_NUMBER, EXPECTED_DELIVERY DATE, SKU_ID, and QUANTITY. Confirm the node mappings match these exact names.
  11. Open the Code node and verify the keys purchase_order, expected_delivery_date, sku, and quantity align with your sheet column mappings. Adjust if you rename columns.
  12. Click Execute test and send a sample email similar to the provided example. Wait up to one minute and check the execution log and your sheet for new rows.
  13. Troubleshoot tips: if no email is picked up, confirm Gmail access and wait for the next poll. If rows do not append, check sheet permissions and column names. If parsing fails, refine the system message or simplify the email format.

Tools Required

$24 / mo or $20 / mo billed annually to use n8n in the cloud. However, the local or self-hosted n8n Community Edition is free.

Gmail

Sign up

No cost: Personal Gmail (Gmail API has no usage-based pricing; quotas apply)

Google Sheets

Sign up

Free: $0 (Google Sheets API usage has no additional cost; quota limits apply)

OpenAI

Sign up

Pay-as-you-go: GPT-5 at $1.25 per 1M input tokens and $10 per 1M output tokens

Credits:
YouTube video

Similar Templates

Join Futurise to access 1,200+ automation templates

Get instant access to ready-made automation workflows for n8n, Make.com, AI agents, and more. Download, customise, and deploy in minutes.