SplitInBatches noItemsLeft: Batch Processing Loop Example

Demonstrates using SplitInBatches node's noItemsLeft context to loop through data batches until all items are processed, ideal for handling large datasets.

n8n
SplitInBatches noItemsLeft: Batch Processing Loop Example

This workflow showcases how to implement a batch processing loop in n8n using the SplitInBatches node combined with its 'noItemsLeft' context variable. It starts with a Manual Trigger, followed by a Function node generating mock data (10 items), which is then split into batches of size 1 by the SplitInBatches node. An IF node checks if noItemsLeft is true, routing to a Set node to confirm completion when all batches are processed; otherwise, it loops back for the next batch.

The key innovation is leveraging the expression {{$node["SplitInBatches"].context["noItemsLeft"]}} in the IF node, which returns true only after all input items are exhausted. This prevents infinite loops and ensures clean termination, making it reliable for production use.

Benefits include avoiding workflow timeouts on large datasets, efficient API pagination, and scalable data transformations. Use cases: bulk email sends, database migrations, API rate limiting, or processing CSV/JSON exports. Replace the Function node with your data source (e.g., HTTP Request, Google Sheets) and adjust batch size for optimal performance.

Customization is straightforward: connect post-processing nodes (e.g., HTTP Request) to the false output of IF, and final actions to the true output. This pattern saves hours of manual scripting and is essential for enterprise-scale automations.

$7.99
Last updated August 29, 2026
30-day money-back guarantee
Instant download
Lifetime updates included

New buyers can create an account from the cart to unlock a controlled $10 first-purchase credit on eligible orders of $25+.

Secure checkout powered by Stripe

Support

How to import this workflow into n8n

  1. 1Purchase or download the workflow to get the n8n workflow JSON file.
  2. 2In your n8n instance, open Workflows and choose "Import from File" (or paste the JSON with Ctrl+V on the canvas).
  3. 3Open each node marked with a credential warning and connect your own accounts and API keys.
  4. 4Run the workflow once manually to verify the data flow, then toggle it to Active.

Related Enterprise workflows

More from Aisha Haddad

Need this deployed? We'll set it up for you.

Our automation experts deploy this workflow in your stack, connect your accounts, and verify it works — or build a custom solution from scratch.