Description
This intelligent n8n workflow uses OpenAI's GPT-4 model to generate structured user data, formats it into tabular CSV files, and saves them automatically to disk. Ideal for developers, data engineers, and automation builders who need dummy or synthetic datasets for testing, prototyping, or analyticsβwithout writing repetitive code or using third-party generators.
π§ How It Works:
Β β π§ Trigger Workflow: Start the workflow manually or through an external trigger (webhook, schedule) β π€ Generate Data with GPT-4: Use the OpenAI node to request a list of 10 random users with these attributes: ββ’ First name and last name starting with the same letter ββ’ Subscription status (true/false) ββ’ Subscription date (only if subscribed) β π§ͺ Use One-Shot Prompting: Provide a sample JSON to OpenAI to ensure consistent output structure β βοΈ Split In Batches: Use the Split In Batches node to handle each OpenAI response individually β π₯ Parse JSON: Convert the OpenAI string response into a usable JSON object β π Create JSON Table: Transform parsed JSON into tabular format for easy CSV conversion β π Convert to CSV: Automatically convert structured JSON data into CSV and assign a dynamic filename β πΎ Save to Disk: Persist the generated CSV file to the .n8n directory (or any mounted volume) β π Loop Back: Continue processing remaining OpenAI responses until all batches are handled
π It Automates:
Β β Dynamic user data generation with controlled structure β Intelligent parsing of OpenAI outputs into structured format β CSV formatting with minimal logic configuration β Batch processing of data without hitting token or payload limits β Local saving of generated files for later use in apps, testing, or analytics
π‘ Why Choose This Workflow:
Β β Avoid manual mock data creation for testing, prototyping, or teaching β Generate realistic, structured data without exposing real user info β Create datasets in minutes without spreadsheets or external tools β Loop-friendly and scalable to more users or attributes β Easily modify prompt or structure for custom schemas (e.g., invoices, addresses, etc.)
π€ Who Is This For:
Β β Developers who need test CSVs for staging environments β Data Scientists requiring synthetic data for analysis or modeling β QA/Test Engineers populating forms, tables, or dashboards β Educators teaching CSV handling or JSON parsing β Prompt Engineers testing structured JSON output from LLMs
π Integrations:
Β β OpenAI GPT-4 (for smart synthetic data generation) β Built-in n8n nodes (Split In Batches, Parse JSON, Function, etc.) β File System (to store CSVs locally in .n8n or Docker-mounted volumes) β Optional: Add Email, S3, Notion, or Google Sheets for distribution
π§ Setup Instructions:
Β π§ Use OpenAI node with GPT-4 and supply one-shot prompt with sample JSON π Add Split In Batches node to handle long responses in chunks π£ Use Parse JSON node to clean string into object π Connect Make JSON Table for structured formatting π Attach Convert to CSV node to transform table into downloadable format πΎ Finalize with Save to Disk node to write CSV to local directory π Loop back to Split node until all responses are processed
π From AI-Generated JSON to CSV β Fully Hands-Free This end-to-end workflow lets you instantly create structured CSV datasets powered by GPT-4 with zero manual effort. Use it in your automations, prototypes, or tutorialsβwherever reliable synthetic data is needed fast.
Link : [https://lovable.dev/projects/705142d2-fb0a-4e7f-a199-d705194df67d]