Data Synchronization and Inventory Audit Tutorial using Compare Datasets - n8n Workflow

Learn to audit and synchronize inventory data between two systems using the powerful Compare Datasets n8n node. This essential n8n workflow identifies items to add, update, or remove.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Data Analysts and Engineers needing to verify data integrity across disparate systems.

  • Inventory Managers seeking automated auditing tools for multi-location stock reconciliation.

  • n8n Users looking to master advanced data comparison and flow control logic within a complex n8n workflow.

  • Anyone searching for practical n8n templates focusing on data synchronization.

Overview

Maintaining data integrity across multiple databases or systems is a major challenge in automation. This specific n8n workflow provides a comprehensive tutorial on solving this problem using the critical 'Compare Datasets' n8n node. This node acts as an automated Auditor, comparing two lists (Warehouse A, the Source of Truth, and Warehouse B, the Target) and identifying all differences: items to add, items to update, items that are identical, and items to remove. This powerful feature allows you to build robust, idempotent n8n templates that prevent duplicate records and ensure synchronization accurately reflects the source data. By implementing this logic within your n8n automation, you can ensure your systems are always in sync, driven by a simple manual n8n trigger in this example.

How it Works

This comprehensive n8n workflow starts with a manual n8n trigger, labeled 'Start Audit'.


  1. Data Preparation (Source & Target): Two 'Set' n8n nodes, 'Warehouse A (Source of Truth)' and 'Warehouse B (To be Synced)', define sample inventory data (products with productid, name, and stock). Warehouse A is configured to be the authoritative source.

  2. Data Structuring: The data arrays from both warehouses are passed to 'Split Out' n8n nodes to process each product as an individual item, which is required for the subsequent comparison n8n node.

  3. The Audit (Compare Datasets n8n node): The core logic is handled by 'The Auditor' (Compare Datasets n8n node). It compares the incoming data sets using productid as the unique matching field. Crucially, it is configured to prioritize Input A (Warehouse A) as the source of truth for updates.

  4. Flow Control and Synchronization: The 'Compare Datasets' n8n node outputs the results into four distinct branches, allowing precise subsequent actions:

Output 0 (Add): Items present in A but missing from B (e.g., the Webcam). These items would be created in a real synchronization n8n workflow.
Output 1 (Match): Items identical in both A and B (e.g., the Keyboard). The flow terminates here as no action is needed.
Output 2 (Update): Items present in both, but data fields are different (e.g., the Mouse, where stock levels differ). These items would be updated in B with A's data.
Output 3 (Remove): Items present in B but missing from A (e.g., the Monitor). These items would be deleted from B to match the source of truth.

Installation Guide

To deploy this powerful data auditing n8n workflow, follow these steps:


  1. Import the JSON: Copy the provided n8n workflow JSON data.

  2. Log into your n8n instance and navigate to the 'Workflows' section.

  3. Click 'New' and select the option to 'Import from JSON'. Paste the n8n workflow code.

  4. Review the Configuration: This specific n8n template uses 'Set' and 'NoOp' nodes for demonstration purposes. No external credentials are required to run this tutorial.

  5. Execute: Click the 'Execute Workflow' button to run the flow and examine the output of the four branching paths provided by the Compare Datasets n8n node.

Node Details

Start Audit (Manual Trigger n8n trigger): Initiates the comparison process manually. Useful for testing this educational n8n template.
Warehouse A/B (Set n8n node): Defines the two input data sets (Warehouse A being the definitive source) as static JSON arrays for demonstration.
Split Out Products (Split Out n8n node): Essential intermediary node that converts the array of products into individual items, enabling the 'Compare Datasets' n8n node to process them one by one.
The Auditor (Compare Datasets n8n node): The core component of this n8n workflow. It is configured to match items based on product_id and uses the Input A version of the data when a difference is detected, ensuring Warehouse A remains the source of truth.


  • Add/Update/Remove/All Good (NoOp n8n node): Placeholder nodes representing the four potential paths for subsequent actions (like calling a CRM, updating a database, or performing file operations). These nodes visually demonstrate the powerful branching capabilities of the Compare Datasets n8n node.

Related n8n Workflows

Free

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

Innovative builder with a passion for crafting automation solutions that solve real-world challenges. From streamlining workflows to driving efficiency, my work empowers teams and individuals to achieve more with less effort. Experienced in developing scalable tools and strategies that deliver results with n8n, supabase and cline.

Featured*