Quick overview
This workflow accepts a CSV upload via an authenticated n8n form, normalizes Ukrainian client data with rule-based parsing, uses OpenAI to extract structured fields from free-text comments, merges duplicates by phone/email, and returns a cleaned CSV ready for CRM import.
How it works
- Receives a CSV file upload through an n8n form protected with Basic Auth.
- Reads the CSV, validates required columns and row limits, and normalizes fields like phone numbers (+380), city names, dates, and emails.
- Batches rows and sends each batch to the OpenAI Responses API to extract structured client details from names and comment text using a strict JSON schema.
- Merges the OpenAI output back into the normalized rows, flagging rows for manual review when the AI response is missing or malformed.
- Deduplicates clients by matching phone numbers and emails, flags near-matches (same name and city) as possible duplicates, and compiles a “що_перевірити” review column.
- Generates a Ukrainian-labeled output CSV and returns it to the browser as a downloadable file.
Setup
- Create and select an n8n Basic Auth credential for the upload form.
- Add an OpenAI API credential (OpenAI API) for the HTTP request to the Responses endpoint.
- Update the Config values (especially columns_json, model, batch_size, and row_limit) to match your source CSV headers and desired processing limits.
- Activate the workflow and use the form URL to upload a CSV and download the cleaned clients_clean.csv output.