Generate and Split Sample Data Records Using JavaScript and Python
A minimal, plug-and-play workflow that generates **sample data** using n8n's **Code** node (both JavaScript and Python versions included) and then **fans out** those records into individual items with **Split Out**. Perfect for testing downstream nodes, mapping, pagination, or prototyping list-based logic without connecting to real data sources. --- ## What this template does - **Generates 20 sample records** with fields: `index`, `num`, and `test` - Writes the array to `item.json` - Uses **Split Out** to convert the array into **one item per record** - Includes **both JavaScript and Python** implementations side-by-side --- ## Who's it for - Builders who need **mock data** to test mappings and loops - Educators/demo makers who want a simple **fan-out pattern** - Anyone who wants a **clean scaffold** for list processing in n8n --- ## How it works / What it does - **Generate Data Javascript**: Produces `barr = [{ index, num, test }, ...]` for 20 rows - **Generate Data Python**: Same output, written in Python - **Split Out Javascript / Python**: Takes `barr` and emits **one item per element** > Use either branch (JS or Python) depending on your preference. --- ## How to set up No external setup required. Import the workflow and **Execute**. Select either the **JavaScript** or **Python** branch to see fan-out items. --- ## Requirements - n8n (Cloud or self-hosted) - No credentials or third-party services --- ## Customize the workflow - Change the number of rows: adjust the loop range (`0..N`) - Rename or add fields to each record (e.g., `name`, `price`, `tags`) - Replace the static array with generated or randomized data - Pipe the Split Out output into **Set**, **Function**, **HTTP**, or **Sheets** nodes for further testing --- ## Notes - Sticky notes are included for in-editor guidance. - Both implementations return the same structure so you can swap freely. --- ## Contact Need help customizing this (e.g., shaping fields, adding randomizers, or exporting to CSV/Sheets)? - 📧 **rbreen@ynteractive.com** - 📞 **Robert Breen** - https://www.linkedin.com/in/robert-breen-29429625/ - 🌐 **ynteractive.com** - https://ynteractive.com
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
- 1Purchase or download the workflow to get the n8n workflow JSON file.
- 2In your n8n instance, open Workflows and choose "Import from File" (or paste the JSON with Ctrl+V on the canvas).
- 3Open each node marked with a credential warning and connect your own accounts and API keys.
- 4Run the workflow once manually to verify the data flow, then toggle it to Active.
Related Development & IT workflows
- Create daily historical AI videos with Gemini, fal.ai, Telegram and YouTube$14.99
- Advanced multi-agent AI personal assistant with 250+ task capabilities (WhatsApp + GPT)$2.99
- Send Organized Security CVE Digests from NVD with AI-Polished Summaries to Gmail$4.99
- Learn n8n basics in 3 easy steps ✨$14.99
- Automated multi-platform sales agent with RAG, CRM & payment processing$2.99
- Version Control n8n Workflows in GitLab with Custom and Organization$14.99
More from Robert Breen
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.