Inventory ABC & Pareto Analysis using Google Sheets for Supply Chain Optimization - n8n Workflow

Use this advanced n8n workflow to perform complex Inventory ABC and Pareto analysis on sales data stored in Google Sheets. Automate supply chain optimization metrics using custom n8n code nodes.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

• Supply Chain Managers seeking automated inventory classification.
• Business Analysts who need to streamline complex data aggregation and statistical reporting.
• Retail Operations teams looking for actionable insights based on item turnover and demand volatility.
• Users who require sophisticated data transformation features beyond standard n8n templates and nodes.

Overview

Effective inventory management hinges on accurate classification, such as the ABC analysis (ranking items by contribution to turnover) and XYZ analysis (ranking items by demand variability). This specialized n8n workflow solves the tedious problem of manually performing these complex, multi-stage calculations.

Starting with raw transactional data extracted from a Google Sheets n8n node, the flow immediately filters out irrelevant zero-sales records. It then splits into four parallel processing pipelines, each handling a critical aspect of supply chain reporting: Daily Store Sales, Multi-Store Cross-Tabulation, Pareto Ranking, and the critical ABC/XYZ classification. By heavily utilizing the Code n8n node, this n8n workflow calculates metrics like cumulative share, standard deviation, and coefficient of variation (CV) for highly accurate stock segmentation, providing immediate value for optimization efforts. This powerful set of n8n templates ensures your inventory strategy is data-driven and automated.

How it Works

The entire process begins with the Manual n8n trigger, initiating the data flow.


  1. Data Extraction: The workflow uses the Google Sheets n8n node to retrieve all transactional data from the designated 'Input Data' sheet.

  2. Filtering: The data passes through a Filter n8n node, removing all transactions where the quantity (QTY) is zero, ensuring clean data for analysis.

  3. Parallel Analysis: The filtered data is channeled into four distinct paths, each driven primarily by custom Code n8n node logic:

a. Store Reporting: The Daily Sales per Store Code n8n node aggregates daily Quantity (QTY) and Turnover (TO) per store. An If n8n node then directs the aggregated results to the respective 'Sales Store 1' or 'Sales Store 2' Google Sheets destination.
b. Turnover Matrix: The TO GroupBy (STORE, ITEM) Code n8n node builds a store-by-item turnover matrix, which is then transposed by the Transpose Code n8n node for cross-store comparison, writing the result via a Google Sheets n8n node.
c. Pareto Analysis (A-B-C Turnover): The TO, QTY GroupBy ITEM Code n8n node sums total turnover and quantity per item. The Pareto Analysis Code n8n node sorts items by turnover and calculates cumulative share and SKU rank. These detailed results are appended to the 'Pareto' sheet using a Google Sheets n8n node.
d. ABC XYZ Classification: The Demand Variability x Sales % Code n8n node calculates statistical measures (mean, standard deviation, coefficient of variation, or CV) per item, essential for XYZ classification. The final ABC Class Mapping Code n8n node applies business logic to assign an ABC class (based on contribution percentage) to each item. The comprehensive output is then saved to the 'ABC XYZ' sheet using the final Google Sheets n8n node in this n8n workflow.

Installation Guide

To deploy and run this comprehensive analysis n8n workflow, follow these steps:


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

  2. Google Sheets Credentials: You must configure the Google Sheets credentials. Navigate to the Credentials section, create a new Google Sheets OAuth2 API credential, and ensure it has access to the target Google Drive folder containing your 'Data Analytics' spreadsheet.

  3. Configure Google Sheets Nodes: Edit every Google Sheets n8n node (Get row(s) in sheet, Sales Store 1/2, Update Pareto Sheet, ABC XYZ Analysis).

Select the shared 'Data Analytics' Document ID.
Verify and select the correct Sheet Names ('Input Data', 'Daily Sales Store 1', 'Daily Sales Store 2', 'Pareto', 'ABC XYZ'). Note that internal sheet GIDs are used, so verify the sheet selection visually.

  1. Execute the n8n trigger: Since this uses a Manual n8n trigger, you can execute the workflow by clicking the 'Execute Workflow' button in the n8n editor to process your data.

Node Details

When clicking ‘Execute workflow’ (Manual Trigger n8n trigger): Starts the entire analytic process manually. This simple n8n trigger is ideal for scheduled or ad-hoc batch processing.
Get row(s) in sheet (Google Sheets n8n node): Function: Extracts the raw transactional sales data, including columns like STORE, DAY, ITEM, QTY, and TO, from the 'Input Data' sheet.
Filter Out Zero Sales (Filter n8n node): Function: Ensures data quality by filtering out any records where QTY (quantity) equals 0, minimizing noise in subsequent calculations.
Daily Sales per Store (Code n8n node): Function: Aggregates sales data to calculate daily totals for QTY and TO grouped by (STORE, DAY). This custom n8n node script ensures accurate daily summary reporting.
Pareto Analysis (Code n8n node): Function: Performs the core Pareto 80/20 analysis. It sorts items by Turnover (TO) descending and computes crucial metrics like absolute cumulative turnover, cumulative share (to identify A/B/C items), and SKU rank.
Demand Variability x Sales % (Code n8n node): Function: Calculates statistical measures for XYZ classification. This custom n8n node determines the mean, standard deviation, and coefficient of variation (CV) for sales quantity per item, measuring demand stability.
ABC Class Mapping (Code n8n node): Function: Assigns inventory classification (A, B, or C) based on customizable cumulative sales contribution thresholds (A: up to 5%, B: up to 20%). This script is critical for the final classification output of this n8n workflow.
Update Pareto Sheet (Google Sheets n8n node): Function: Appends the fully ranked and analyzed Pareto results, including cumulative share percentages, back to the 'Pareto' sheet for visualization.


  • ABC XYZ Analysis (Google Sheets n8n node): Function: Appends the final results combining ABC (contribution) and XYZ (variability) metrics, offering a complete matrix for inventory strategy planning.

Related n8n Workflows

Free

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

Automation, AI and Analytics for Supply Chain & Business Optimization Helping businesses streamline operations using n8n, AI agents, and data science to enhance efficiency and sustainability. Linkedin: www.linkedin.com/in/samir-saci

Featured*