Count Items Returned by Any Node

Simple workflow to count output items from any upstream node using a Set node with Execute Once and $input.all().length expression.

n8n
Count Items Returned by Any Node

This workflow demonstrates an efficient way to count the number of items produced by a preceding node in n8n. It starts with a Manual Trigger, fetches sample data from the Customer Datastore node (which returns multiple people records), and then uses a Set node configured with 'Execute Once' to compute the total count via the expression {{ $input.all().length }}. The result is a single item containing the 'itemCount' value, making it ideal for debugging or logging purposes without altering data flow.

The key benefit is simplicity and reusability: no custom code nodes or complex expressions needed. By leveraging n8n's built-in $input.all() method, you get all incoming items at once and use JavaScript's .length property for instant counting. This keeps workflows lightweight and performant, especially useful after nodes like HTTP Request, database queries, or splits that generate variable item counts.

Use cases include monitoring API responses, validating data imports, aggregating batch sizes in ETL processes, or integrating into larger automations for conditional logic (e.g., 'if count > 10, notify'). It's perfect for developers troubleshooting workflows or building dynamic routers based on item volume. Easily adapt by inserting after any node—no modifications required.

$4.99
Last updated October 3, 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 Travel workflows

More from BestWorkflows

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.