AI Agent: GPT-4 Powered CSV Mock Data Generator
Integrates with:
Overview
Unlock Rapid Mock Data Creation with this AI Agent
This n8n AI agent utilizes OpenAI's GPT-4 to intelligently generate structured mock data based on your specifications. It's designed to quickly produce multiple CSV files filled with fictional user data, streamlining tasks like application testing, creating demo content, or populating development environments.
The agent takes a detailed prompt, instructs GPT-4 to return a JSON array of data (e.g., user profiles), and then processes this output. It can generate multiple distinct datasets in one run (controlled by the 'n' parameter in the OpenAI node), parse the JSON, convert each dataset into a table, and save them as individual CSV files. It also includes steps to handle common formatting issues like UTF BOM bytes for cleaner CSV output.
Key Features & Benefits
- AI-Powered Data Generation: Uses GPT-4 to create diverse and contextually relevant mock data based on your custom prompts.
- JSON to CSV Conversion: Seamlessly transforms the AI-generated JSON output into ready-to-use CSV files.
- Batch Processing: Generates multiple CSV files from a single execution, configured by the OpenAI node's 'n' parameter (e.g.,
n:3
produces 3 files). - Customizable Output: Tailor the data structure, content, and naming conventions for your CSV files through prompts and node parameters.
- Automated Formatting: Includes steps to strip UTF BOM bytes, ensuring clean and compatible CSVs.
- Time-Saving Automation: Drastically reduces the manual effort required to create sample datasets.
- Versatile Use Cases: Ideal for solopreneurs, founders, CTOs, and developers needing quick mock data for various purposes.
Use Cases
- Quickly generating sample user data for testing application features.
- Creating multiple mock CSV files for software demonstrations or client presentations.
- Populating development or staging databases with varied initial data.
- Producing datasets for data analysis workshops or training.
- Automating the creation of test fixtures for backend services or data pipelines.
Prerequisites
- An n8n instance (Cloud or self-hosted).
- An OpenAI API Key with access to the GPT-4 model.
- Write permissions to the directory where CSV files will be saved (default is
./.n8n/
relative to the n8n execution environment).
Setup Instructions
- Download the n8n workflow JSON file.
- Import the workflow into your n8n instance.
- Configure the 'OpenAI' node:
- Select or add your OpenAI API credentials.
- Review and customize the prompt in the 'Prompt' field to define the structure and content of the JSON data GPT-4 should generate. The current prompt asks for a list of 10 fictional users with specific attributes.
- Adjust the 'n' parameter under 'Options' to specify how many separate JSON arrays (and thus CSV files) GPT-4 should generate (default is 3).
- Review Data Processing Nodes:
- The 'Split In Batches' node is set to process each of OpenAI's
n
outputs individually. - The 'Parse JSON' node (a Set node) parses the text output from OpenAI into a usable JSON structure.
- The 'Make JSON Table' node (an Item Lists node) flattens the JSON array into individual items for CSV conversion.
- The 'Split In Batches' node is set to process each of OpenAI's
- Customize File Output (Optional):
- In the 'Convert to CSV' node, modify the
fileName
parameter under 'Options' to change the naming pattern for your CSV files. The current pattern isfunny_names_{{ $('Split In Batches').item.json.index+1 }}.csv
. - In the 'Save to Disk' node, adjust the
fileName
parameter to change the save location or confirm the default (./.n8n/{{ $binary.data.fileName }}
).
- In the 'Convert to CSV' node, modify the
- Ensure the 'Strip UTF BOM bytes' and 'Create valid binary' nodes are active if you anticipate issues with CSV encoding (they help ensure compatibility).
- Activate the workflow.
- Click "Execute Workflow" to run it manually. The generated CSV files will be saved to the specified path.
Want your own unique AI agent?
Talk to us - we know how to build custom AI agents for your specific needs.
Schedule a Consultation