← All N8N workflows
AI & researchAgentCodeGmail TriggerGoogle SheetsIf

Test the workflow with this email!

Configured with Agent, Gmail Trigger, Google Sheets, OpenAI Chat Model, and additional nodes. Review the connections and setup before adapting this template.

Workflow preview
AI & modelsAI AgentAgentAI & modelsOpenAI Chat ModelOpenAI Chat ModelTransformStructured OutputParserOutput Parser StructuredData storeStore Purchase OrderLinesGoogle SheetsTriggerEmail ReceivedGmail TriggerRoutingIs PO?IfCodeFormat Purchase OrderLinesCode

Node categories in this workflow

  • AI & models
  • Transform
  • Data store
  • Trigger
  • Routing
  • Code

Icons describe general node roles, inferred from node types. Inspect the parameters for the configured action.

Drag to pan; use + and − to zoom. Reconstructed from the exported node positions; nothing runs here. Dashed lines represent non-main connections. Full node names and notes appear below.

How it works

The exported workflow contains the following configured nodes. Their connections are shown above; inspect the JSON for the complete logic, expressions, and external actions.

Workflow node names, types, and operations
NodeCategoryTypeOperation
AI AgentAI & modelsAgentSee node parameters
OpenAI Chat ModelAI & modelsOpenAI Chat ModelSee node parameters
Structured Output ParserTransformOutput Parser StructuredSee node parameters
Store Purchase Order LinesData storeGoogle Sheetsappend
Email ReceivedTriggerGmail TriggerSee node parameters
Is PO?RoutingIfSee node parameters
Format Purchase Order LinesCodeCodeSee node parameters

Setup

  1. Download the JSON and import it into an isolated n8n instance. Leave the workflow inactive.
  2. Connect your own credentials through n8n’s credential store. Replace REPLACE_WITH_* values with your resource identifiers.
  3. Inspect API destinations, Code nodes, database queries, file paths, and outbound actions.
  4. Run with synthetic data and harmless destinations. Enable triggers only after checking the actual outputs.

Requirements

An n8n instance with the listed node types and compatible versions. Service-connected workflows may require accounts, credentials, or paid APIs.

Credential types declared in the source

None declared. HTTP requests and Code nodes may still need configuration.

Workflow notes

4. Do you need more details?

4. Do you need more details?

Find a step-by-step guide in this tutorial 🎥 Watch My Tutorial

1. Workflow Trigger with Gmail Trigger

1. Workflow Trigger with Gmail Trigger

The workflow is triggered by a new email received in your Gmail mailbox. If the subject includes the string "Inbound Order" we proceed, if not we do nothing.

How to setup?

2. AI Agent equipped with the query tool

2. AI Agent equipped with the query tool

The email body and subject are sent to the AI agent for parsing. The results include the PO Number, expected delivery date and all the order lines with SKU ID and order quantity. Outputs are formatted by the code node to fit in a Google Sheet.

How to setup?

  • AI Agent with the Chat Model:
    1. Add a chat model with the required credentials (Example: Open AI 4o-mini)
    2. Adapt the system prompt to the format of your emails Learn more about the AI Agent Node
3. Store the orderlines in a Google Sheet

3. Store the orderlines in a Google Sheet

The table generated by the code node includes all the order lines with the PO Number and the expected delivery date. This Google Sheet Node loads the content in a Google Sheet.

How to setup?

  • Add Results in Google Sheets:
    1. Add your Google Sheet API credentials to access the Google Sheet file
    2. Select the file using the list, an URL or an ID
    3. Select the sheet in which the vocabulary list is stored
    4. Create the columns: PO_NUMBER, EXPECTED_DELIVERY DATE, SKU_ID, QUANTITY Learn more about the Google Sheet Node
Test the workflow with this email!

Test the workflow with this email!

How?

  1. Send this email to the Gmail box you set up in your credentials.
  2. Click on Test workflow

Email

Email Subject: Inbound Order PO45231 – Expected Delivery on 2025-03-27

Email Body: Dear LogiGreen Team,

Please find below the details of the upcoming inbound order.

Purchase Order: PO45231 Expected Delivery Date: 27/03/2025

Order Lines:

SKU: HERM-SHOE-001 — Qty: 120

SKU: HERM-BAG-032 — Qty: 45

SKU: HERM-WATCH-105 — Qty: 30

SKU: HERM-SCARF-018 — Qty: 80

Let us know if you need any additional details.

Best regards, Sophie Lambert Admin Assistant – Hermas Logistics 📞 +33 1 23 45 67 89 78 84 ✉️ user@example.com

Test the workflow with this email!

Test the workflow with this email!

Purpose and structure

This folder contains the Test the workflow with this email! workflow. Its executable nodes use agent, code, gmailTrigger, googleSheets, if, lmChatOpenAi, outputParserStructured. The table and connection map below are derived from the JSON, not an inferred guarantee of behavior.

Setup

Import inactive. Configure your own credentials and replace REPLACE_WITH_* values. Review external destinations and Code nodes before running.

Entry points

Email Received

Verification

Sanitized source candidate; not runtime-tested. This overview is generated from node metadata. Read the folder README for the connection map, credential types, and license.

Attribution

https://github.com/Zie619/n8n-workflows/blob/94007c1445d9258a7da116646b79473e7c7c3282/workflows/Googlesheets/0814_GoogleSheets_Gmail_Send_Triggered.json MIT; preserve source notices.

More in AI & research