The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"nodes": [
{
"id": "5b43e57d-1fe1-4ea6-bf3d-661f7e5fc4b0",
"name": "When clicking \"Execute Workflow\"",
"type": "n8n-nodes-base.manualTrigger",
"position": [
960,
240
],
"parameters": {},
"typeVersion": 1
},
{
"id": "291466e8-1592-4080-a675-5e9f486d0d05",
"name": "OpenAI",
"type": "n8n-nodes-base.openAi",
"position": [
1160,
240
],
"parameters": {
"model": "gpt-4",
"prompt": {
"messages": [
{
"content": "=please create a list of 10 random users. Return back ONLY a JSON array. Character names of famous fiction characters. Make Names and Surnames start with the same letter. Name and Surname can be from different characters. If subscribed is false then make date_subscribed empty. If date_subscribed is not empty then make it random and no later then 2023-10-01. Make JSON in a single line, avoid line breaks. Here's an example: [{\"user_name\": \"Jack Jones\", \"user_email\":\"jackjo@yahoo.com\",\"subscribed\": true, \"date_subscribed\":\"2023-10-01\" },{\"user_name\": \"Martin Moor\", \"user_email\":\"mmoor@gmail.com\",\"subscribed\": false, \"date_subscribed\":\"\" }]"
}
]
},
"options": {
"n": 3,
"maxTokens": 2500,
"temperature": 1
},
"resource": "chat"
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "edd5bed7-a8a1-4298-b026-3b0061c5064a",
"name": "Split In Batches",
"type": "n8n-nodes-base.splitInBatches",
"position": [
1340,
240
],
"parameters": {
"options": {},
"batchSize": 1
},
"typeVersion": 2
},
{
"id": "f0e414e6-741a-42db-86eb-ba95e220f9ef",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
940,
80
],
"parameters": {
"width": 600,
"height": 126,
"content": "## This is a helper workflow to create 3 CSV files\n### Feel free to adapt as needed\n### Some mock data from GPT is pinned for convenience"
},
"typeVersion": 1
},
{
"id": "f1c2891f-5110-423c-9fb4-37e0a0d0f750",
"name": "Parse JSON",
"type": "n8n-nodes-base.set",
"position": [
1520,
240
],
"parameters": {
"fields": {
"values": [
{
"name": "content",
"type": "arrayValue",
"arrayValue": "={{JSON.parse($json.message.content)}}"
}
]
},
"include": "none",
"options": {}
},
"typeVersion": 3
},
{
"id": "ce59d3e1-3916-48ad-a811-fa19ad66284a",
"name": "Make JSON Table",
"type": "n8n-nodes-base.itemLists",
"position": [
1700,
240
],
"parameters": {
"options": {},
"fieldToSplitOut": "content"
},
"typeVersion": 3
},
{
"id": "8b1fda14-6593-4cc2-ab74-483b7aa4d84a",
"name": "Convert to CSV",
"type": "n8n-nodes-base.spreadsheetFile",
"position": [
1880,
240
],
"parameters": {
"options": {
"fileName": "=funny_names_{{ $('Split In Batches').item.json.index+1 }}.{{ $parameter[\"fileFormat\"] }}",
"headerRow": true
},
"operation": "toFile",
"fileFormat": "csv"
},
"typeVersion": 2
},
{
"id": "d2a621e0-88df-4642-91ab-772f062c8682",
"name": "Save to Disk",
"type": "n8n-nodes-base.writeBinaryFile",
"position": [
2420,
240
],
"parameters": {
"options": {},
"fileName": "=./.n8n/{{ $binary.data.fileName }}"
},
"typeVersion": 1
},
{
"id": "20f60bb0-0527-44c4-85d5-a95c20670893",
"name": "Strip UTF BOM bytes",
"type": "n8n-nodes-base.moveBinaryData",
"position": [
2060,
240
],
"parameters": {
"options": {
"encoding": "utf8",
"stripBOM": true,
"jsonParse": false,
"keepSource": false
},
"setAllData": false
},
"typeVersion": 1
},
{
"id": "bda91493-df5d-4b8c-b739-abca6045faf9",
"name": "Create valid binary",
"type": "n8n-nodes-base.moveBinaryData",
"position": [
2240,
240
],
"parameters": {
"mode": "jsonToBinary",
"options": {
"addBOM": false,
"encoding": "utf8",
"fileName": "=funny_names_{{ $('Split In Batches').item.json.index+1 }}.{{ $('Convert to CSV').first().binary.data.fileExtension }}",
"mimeType": "text/csv",
"keepSource": false,
"useRawData": true
},
"convertAllData": false
},
"typeVersion": 1
},
{
"id": "e1b54e0d-56a5-43e7-82b4-aaead2875a9d",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
2007,
140
],
"parameters": {
"width": 394,
"height": 254,
"content": "### These 2 nodes fix an issue with BOM bytes in the beginning of the file.\nWithout them reading the CSV file back becomes tricky"
},
"typeVersion": 1
}
],
"connections": {
"OpenAI": {
"main": [
[
{
"node": "Split In Batches",
"type": "main",
"index": 0
}
]
]
},
"Parse JSON": {
"main": [
[
{
"node": "Make JSON Table",
"type": "main",
"index": 0
}
]
]
},
"Save to Disk": {
"main": [
[
{
"node": "Split In Batches",
"type": "main",
"index": 0
}
]
]
},
"Convert to CSV": {
"main": [
[
{
"node": "Strip UTF BOM bytes",
"type": "main",
"index": 0
}
]
]
},
"Make JSON Table": {
"main": [
[
{
"node": "Convert to CSV",
"type": "main",
"index": 0
}
]
]
},
"Split In Batches": {
"main": [
[
{
"node": "Parse JSON",
"type": "main",
"index": 0
}
]
]
},
"Create valid binary": {
"main": [
[
{
"node": "Save to Disk",
"type": "main",
"index": 0
}
]
]
},
"Strip UTF BOM bytes": {
"main": [
[
{
"node": "Create valid binary",
"type": "main",
"index": 0
}
]
]
},
"When clicking \"Execute Workflow\"": {
"main": [
[
{
"node": "OpenAI",
"type": "main",
"index": 0
}
]
]
}
}
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
openAiApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
How this works
This workflow streamlines the preparation of CSV files by leveraging GPT-4 to intelligently process and format raw data, saving you hours of manual editing and ensuring consistent, high-quality outputs ready for analysis or sharing. It's ideal for data analysts, marketers, or small business owners handling messy datasets like customer feedback or sales logs, who need reliable file structuring without deep coding skills. The key step involves feeding your data into OpenAI for refinement, followed by batch processing and conversion to a clean CSV format using integrations like OpenAI and spreadsheet tools.
Use this workflow when you have unstructured text data that requires AI-driven cleaning and tabular conversion, such as turning JSON responses into exportable spreadsheets for quick reporting. Avoid it for massive datasets exceeding GPT-4's token limits or when simple formatting suffices without AI intervention. Common variations include adding email notifications post-export or integrating with Google Sheets for direct cloud uploads.
About this workflow
Prepare Csv Files With Gpt 4. Uses manualTrigger, openAi, splitInBatches, stickyNote. Event-driven trigger; 11 nodes.
Source: https://github.com/Zie619/n8n-workflows — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
This workflow generates CSV files containing a list of 10 random users with specific characteristics using OpenAI's GPT-4 model. It then splits this data into batches, converts it to CSV format, and s
Export Csv File To Json. Uses manualTrigger, readBinaryFile, spreadsheetFile, moveBinaryData. Event-driven trigger; 5 nodes.
PCN. Uses googleSheets, httpRequest, @n-octo-n/n8n-nodes-json-database, itemLists. Event-driven trigger; 60 nodes.
Working With Excel Spreadsheet Files Xls Xlsx. Uses stickyNote, readBinaryFile, manualTrigger, writeBinaryFile. Event-driven trigger; 24 nodes.
This workflow will help guide you through obtaining a spreadsheet file, reading it, making a change then saving it to local or cloud storage.