Automated Inventory Procurement and Purchase Order Logging - n8n Workflow

Automate inventory management using this n8n workflow. It daily checks stock levels in Google Sheets, calculates reorders, generates purchase orders, sends supplier emails via Gmail, and logs all PO data. Discover more n8n templates.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Inventory Managers and Operations Teams needing hands-off stock level monitoring.
E-commerce businesses aiming to automate restocking processes.
Users looking for advanced examples of combining Google Sheets and Gmail automation within an n8n template.
Technical users wanting to see how custom logic (Code n8n node) can drive business processes.

Overview

Maintaining optimal inventory levels is crucial, but manual checks are time-consuming and prone to error. This powerful n8n workflow solves this by completely automating the procurement cycle.

Starting with an n8n trigger, it scans your primary inventory sheet in Google Sheets for any item tagged as 'Low Stock.' It then applies custom business logic (using the Code n8n node) to intelligently determine the exact quantity needed, factoring in thresholds, minimum orders, and maximum order limits. The system aggregates orders by supplier, generates professional email drafts for the purchase order, sends them using Gmail, and simultaneously logs all PO details to a dedicated Purchase Order sheet in Google Sheets. This robust n8n automation ensures you never miss a reorder point, saving time and preventing stockouts.

How it Works

This comprehensive n8n workflow executes daily based on a scheduled n8n trigger:


  1. Scheduled Execution: The Trigger Everyday n8n trigger initiates the automation at a set time (e.g., daily).

  2. Data Retrieval: The Get Low Stock Product n8n node queries the Google Sheet, fetching all inventory rows where the 'Inventory Status' is 'Low Stock'.

  3. Order Calculation: The Order Handling Code n8n node runs custom JavaScript to analyze each item's stock level against its minimum threshold. It calculates the order_qty needed, respecting defined minimum and maximum order constraints.

  4. PO Generation: The Generate Email & PO Code n8n node groups the calculated orders by supplier. It dynamically generates the standardized purchase order email body, subject, and creates separate data items representing the PO rows to be logged.

  5. Flow Control: The Switch Email & PO n8n node directs flow based on the item type (Email or PO).

  6. Email Dispatch: The 'Email' path sends the finalized Purchase Order email to the respective supplier using the Gmail n8n node.

  7. PO Logging Preparation: The 'Purchase Order' path enters the Loop Over Items n8n node to process each SKU’s PO row individually.

  8. Duplicate Check: The Get Purchase Order Google Sheets n8n node checks the 'Purchase Order' sheet to see if an 'In Progress' order already exists for that specific SKU.

  9. Conditional Logic: The Check Record Exists Or Not If n8n node evaluates the check. If an active PO exists, the item is routed to No Operation, do nothing. If not, it proceeds.

  10. Record PO: The Store a Purchase Order Google Sheets n8n node appends the new PO details (including PO Number, Order Qty, and status 'In Progress') to the tracking sheet, completing the inventory management n8n workflow.

Installation Guide

To deploy this powerful n8n workflow and start automating your procurement, follow these steps:


  1. Import the n8n template: Copy the provided JSON and paste it into your n8n instance using the 'New' > 'Import from JSON' option.

  2. Google Sheets Credentials: You will need to set up credentials for the Google Sheets n8n node. Ensure your service account has read/write access to the specific Inventory Management spreadsheet specified in the Get Low Stock Product and Store a Purchase Order nodes.

  3. Gmail Credentials: Set up or select existing Gmail credentials for the Send Order to Suplier n8n node. This account must be authorized to send emails on behalf of your procurement team.

  4. Update Spreadsheet ID: The Google Sheets n8n node configurations reference a specific documentId. Update this ID to point to your actual Inventory Management spreadsheet.

  5. Review Logic: If your column headers differ from 'Available Qty', 'Min. Threshold', 'Min Order', 'Max Order', or 'Inventory Status', adjust the column names within the Get Low Stock Product filter and the JavaScript code blocks of the Order Handling n8n node.

  6. Activate: Once credentials are set and logic is confirmed, save and activate the n8n workflow.

Node Details

Trigger Everyday (Schedule Trigger n8n trigger): Initiates the entire n8n workflow daily to check stock levels automatically.
Get Low Stock Product (Google Sheets n8n node): Fetches rows from the 'Inventory Stock' sheet where 'Inventory Status' equals 'Low Stock'.
Order Handling (Code n8n node): Implements custom business logic to calculate the precise orderqty needed based on inventory rules (thresholds, minimums, and maximums).
Generate Email & PO (Code n8n node): Groups calculated orders by supplier email and dynamically generates the email content (subject and body) and separate PO record data points.
Switch Email & PO (Switch n8n node): Controls the subsequent flow, routing the data items tagged as 'email' towards Gmail and items tagged as 'po' toward the logging loop.
Send Order to Suplier (Gmail n8n node): Uses expression mapping (={{ $json.supplier
email }}) to send the dynamically generated purchase order email to the correct supplier.
Loop Over Items (SplitInBatches n8n node): Breaks the grouped PO logging data back into individual items for processing and checking against existing records.
Get Purchase Order (Google Sheets n8n node): Checks the 'Purchase Order' sheet for existing active orders (Order Status: In Progress) related to the current SKU.
Check Record Exists Or Not (If n8n node): Determines if the previous Google Sheets n8n node returned any existing record. If the PO record does not exist, it proceeds to create one.
Store a Purchase Order (Google Sheets n8n node): Appends the new purchase order details to the designated 'Purchase Order' sheet, setting the initial 'Order Status' to 'In Progress'.

Related n8n Workflows

Free

Nodes: 9 Nodes
Updated: December 26 2025
View all
Created by

We are an AI Automation Agency focusing on various AI Automation Services like, workflow automation, shopify automation, chatbot developerment, custom ai agent development and more.

Featured*