This advanced n8n workflow template uses AI to automatically extract, validate, and process purchase orders submitted as XLSX attachments via Microsoft Outlook, eliminating manual data entry.
Download this n8n workflow template and start using it instantly.
Finance and Accounting Teams: Users burdened by manual data entry from standardized PO forms.
Automation Specialists: Those looking for practical n8n templates integrating email, file processing, and advanced AI extraction.
Operations Managers: Professionals seeking to validate incoming business documentation automatically.
Developers: Individuals needing an example of converting complex files (XLSX) into LLM-readable formats (Markdown) within an n8n workflow.
Handling purchase orders submitted as standardized Excel (XLSX) forms is a classic pain point in business operations. Data entry is tedious, error-prone, and time-consuming. This sophisticated n8n workflow addresses this challenge head-on by creating a touchless automation pipeline.
The core value of this n8n template lies in its ability to receive an email via the n8n trigger, classify its intent using AI, transform the complex binary XLSX data into a simple Markdown table, and then use the OpenAI Information Extractor to pull out critical, structured data points like line items and totals. Furthermore, the n8n workflow includes vital validation checks (e.g., ensuring line item totals match the grand total) before sending confirmation or rejection replies via Outlook. This drastically reduces administrative overhead and ensures data quality before integration into an ERP or accounting system.
This comprehensive n8n workflow follows several distinct stages:
Outlook Trigger n8n node, which constantly monitors a specified inbox for new emails containing attachments. This is the primary n8n trigger for the automation.Text Classifier (an n8n node utilizing OpenAI), which validates that the sender's intent is truly a purchase order submission, filtering out general queries.Extract from File n8n node parses the XLSX data, which is then processed by a Code n8n node (XLSX to Markdown Table). This code logic iterates through the rows and structures the output into a clean, markdown-formatted table.Information Extractor n8n node. Leveraging an OpenAI Chat Model (e.g., GPT-4o-mini), the AI extracts structured JSON data based on a predefined PO schema (including vendor details, PO number, and line item arrays).Set n8n node (Fix Excel Dates) handles Excel's date serial number formatting. Following this, the Run Checks n8n node calculates sums and validates key fields (PO number presence, valid date, and critical math check: line item total = purchase order total).Is Valid Purchase Order? n8n node routes the flow. If validation passes, a confirmation is sent via Outlook (Reply Accepted), and the structured data proceeds to a placeholder n8n node (Do Something with Purchase Order) for downstream ERP integration. If validation fails, a detailed rejection message is sent (Reply Rejection), informing the buyer of the specific errors detected by this automated n8n workflow.To deploy this powerful n8n workflow template, follow these steps:
Outlook Trigger and subsequent Outlook n8n nodes. Ensure the account has permission to read the desired inbox and send replies. Refer to the n8n documentation for Microsoft credential setup.OpenAI Chat Model and OpenAI Chat Model1). This is crucial for the classification and information extraction steps.Extract Purchase Order Details n8n node. If your PO form requires different fields, update the JSON schema accordingly. You may also need to adjust the logic in the XLSX to Markdown Table n8n node depending on the complexity of your source Excel file structure.Do Something with Purchase Order n8n node to integrate with your specific ERP, database, or accounting system.This n8n workflow utilizes several key n8n node types:
Outlook Trigger (n8n trigger):
Function: Starts the n8n workflow upon receiving an email.
Key Configuration: Filters for emails that have attachments and downloads those attachments immediately.
Text Classifier (n8n node):
Function: Uses AI to determine if the email's intent is to submit a purchase order.
Key Configuration: Uses an external OpenAI model (gpt-4o-mini) to classify the input text against the category 'ispurchaseorder'.
If (n8n node):
Function: Used twice. First, to check the attachment's MIME type (ensuring it is XLSX). Second (Is Valid Purchase Order?), to check the overall success of the validation steps.
Key Configuration: Checks if mimeType equals application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.
Extract from File (n8n node):
Function: Parses the binary XLSX file content, making the row data accessible.
Key Configuration: Operation set to xlsx with rawData enabled.
Code (n8n node - 'XLSX to Markdown Table'):
Function: Converts the array of Excel rows into a clean, LLM-readable Markdown table structure.
Key Configuration: Custom JavaScript logic is used to concatenate rows and add Markdown table formatting.
Information Extractor (n8n node):
Function: Takes the Markdown table and uses a connected OpenAI model to extract structured data based on a provided JSON schema (PO number, date, vendor, items).
Key Configuration: Defined complex JSON schema for structured output, targeting line items as an array of objects.
Set (n8n node - 'Run Checks'):
Function: Performs critical validation checks.
Key Configuration: Uses n8n expressions to check for data presence (hasponumber) and mathematical accuracy ($json.output.items.map(item => item.unitprice item.quantity).sum().round(2) === $json.output.purchaseorder_total.round(2)).
Microsoft Outlook (n8n node - Replies):
Function: Sends automated responses (acceptance, rejection, invalid format) back to the original sender.
* Key Configuration: Operation set to reply, dynamically referencing the original email ID from the n8n trigger.
Use this powerful n8n workflow to instantly triage maintenance requests from JotForm using GPT-4o, automatically route emergency and standard work orders via Gmail, and maintain detailed logs in Google Sheets. This advanced n8n automation streamlines property management operations.

Automate real estate marketing tasks with this powerful n8n workflow. Use Bitly to shorten property links and generate scannable QR codes, automatically updating Google Sheets. Get started with n8n templates.

Automate professional LinkedIn posts by combining real-time trends and AI image generation. Use this powerful n8n workflow for consistent, high-quality social media content using GPT and DALL-E.

Use this powerful n8n workflow to automatically create new QuickBooks customers and generate sales estimates whenever a new row is added to Google Sheets. Streamline your CRM processes with this n8n template.

Use this powerful n8n workflow to automatically sync new customer data from Google Sheets into QuickBooks Online, checking for existing records and creating corresponding Sales Receipts using a custom n8n trigger.


Freelance consultant based in the UK specialising in AI-powered automations. I work with select clients tackling their most challenging projects. For business enquiries, send me an email at [email protected] LinkedIn: https://www.linkedin.com/in/jimleuk/ X/Twitter: https://x.com/jimle_uk







































