Beispieldatensätze mit JavaScript und Python generieren und aufteilen

Fortgeschritten

Dies ist ein Engineering, Miscellaneous, Multimodal AI-Bereich Automatisierungsworkflow mit 7 Nodes. Hauptsächlich werden Code, SplitOut, ManualTrigger und andere Nodes verwendet. Generieren und Aufteilen von Beispieldatensätzen mit JavaScript und Python

Voraussetzungen
  • Keine besonderen Voraussetzungen, sofort nach Import nutzbar
Workflow-Vorschau
Visualisierung der Node-Verbindungen, mit Zoom und Pan
Workflow exportieren
Kopieren Sie die folgende JSON-Konfiguration und importieren Sie sie in n8n
{
  "meta": {
    "instanceId": "ad0113c344ee237399e44e9f11798b05baeb83a6196d514a9ae9d2ad71c3b5c9",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "934a8c2f-845f-4f88-8355-48ef17e50f32",
      "name": "Notizzettel1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1120,
        1984
      ],
      "parameters": {
        "color": 7,
        "width": 1696,
        "height": 1056,
        "content": "### Create sample records with Code and split to items in n8n (Code + Split Out)\n\nA 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.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "34f6b8c5-171b-4027-907b-cc8a41bd75a4",
      "name": "Notizzettel10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1552,
        1984
      ],
      "parameters": {
        "width": 400,
        "height": 1056,
        "content": "\n## ✅ What this template does\n- **Generates 20 sample records** with fields: `index`, `num`, and `test`\n- Writes the array to `item.json.barr`\n- Uses **Split Out** to convert the array into **one item per record**\n- Includes **both JavaScript and Python** implementations side-by-side\n\n---\n\n- 📧 **rbreen@ynteractive.com**  \n- 🔗 **Robert Breen** — https://www.linkedin.com/in/robert-breen-29429625/  \n- 🌐 **ynteractive.com** — https://ynteractive.com\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "2dab6b4d-2d05-4294-8d6d-620513a777fc",
      "name": "Generate Data Javascript",
      "type": "n8n-nodes-base.code",
      "position": [
        -480,
        2368
      ],
      "parameters": {
        "jsCode": "// In n8n Code node, \"items\" is an array of input objects\n// You must return an array of items at the end\n\nreturn items.map(item => {\n  const arr = [];\n\n  for (let i = 0; i < 20; i++) {\n    arr.push({\n      index: i,\n      num: i + 1,\n      test: \"asdasd\"\n    });\n  }\n\n  // attach to item.json\n  item.json.barr = arr;\n  return item;\n});\n"
      },
      "typeVersion": 2
    },
    {
      "id": "c12e4e24-e1bd-4f32-98fd-876d91e79661",
      "name": "Generate Data Python",
      "type": "n8n-nodes-base.code",
      "position": [
        -480,
        2560
      ],
      "parameters": {
        "language": "python",
        "pythonCode": "arr = [{\"index\": i, \"num\": i + 1, \"test\": \"asdasd\"} for i in range(20)]\nreturn [{\"json\": {\"barr\": arr}}]\n"
      },
      "typeVersion": 2
    },
    {
      "id": "5128ea0a-8d3d-49d1-bba2-102881725941",
      "name": "Start Workflow",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -848,
        2368
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "50e53b82-2556-4f8a-9b41-ed911d7319cc",
      "name": "Split Out Javascript",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        -272,
        2368
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "barr"
      },
      "typeVersion": 1
    },
    {
      "id": "ee5064bc-a511-4d63-9cef-67ff348d76a2",
      "name": "Split Out Python",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        -272,
        2560
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "barr"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "5128ea0a-8d3d-49d1-bba2-102881725941": {
      "main": [
        [
          {
            "node": "2dab6b4d-2d05-4294-8d6d-620513a777fc",
            "type": "main",
            "index": 0
          },
          {
            "node": "c12e4e24-e1bd-4f32-98fd-876d91e79661",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "c12e4e24-e1bd-4f32-98fd-876d91e79661": {
      "main": [
        [
          {
            "node": "ee5064bc-a511-4d63-9cef-67ff348d76a2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "2dab6b4d-2d05-4294-8d6d-620513a777fc": {
      "main": [
        [
          {
            "node": "50e53b82-2556-4f8a-9b41-ed911d7319cc",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Häufig gestellte Fragen

Wie verwende ich diesen Workflow?

Kopieren Sie den obigen JSON-Code, erstellen Sie einen neuen Workflow in Ihrer n8n-Instanz und wählen Sie "Aus JSON importieren". Fügen Sie die Konfiguration ein und passen Sie die Anmeldedaten nach Bedarf an.

Für welche Szenarien ist dieser Workflow geeignet?

Fortgeschritten - Engineering, Verschiedenes, Multimodales KI

Ist es kostenpflichtig?

Dieser Workflow ist völlig kostenlos. Beachten Sie jedoch, dass Drittanbieterdienste (wie OpenAI API), die im Workflow verwendet werden, möglicherweise kostenpflichtig sind.

Workflow-Informationen
Schwierigkeitsgrad
Fortgeschritten
Anzahl der Nodes7
Kategorie3
Node-Typen4
Schwierigkeitsbeschreibung

Für erfahrene Benutzer, mittelkomplexe Workflows mit 6-15 Nodes

Autor
Robert Breen

Robert Breen

@rbreen

Professional services consultant with over 10 years of experience solving complex business problems across industries. I specialize in n8n and process automation—designing custom workflows that integrate tools like Google Calendar, Airtable, GPT, and internal systems. Whether you need to automate scheduling, sync data, or streamline operations, I build solutions that save time and drive results.

Externe Links
Auf n8n.io ansehen

Diesen Workflow teilen

Kategorien

Kategorien: 34