Skip to main content
AltFTool original, tested in n8nData TransformationEngineering

Clean and normalize CSV data with the Code node - n8n workflow template

Messy spreadsheets are one of the most common reasons people start automating. This workflow shows a complete cleanup pipeline using only built-in nodes, and it ships with a deliberately untidy sample so you can watch every fix happen. Parse CSV is a small parser written in the…

Written and tested by AltFTool

Starts on
Manual run
Nodes
6 nodes
Level
Beginner
Setup
About 2 min

Workflow preview

How this workflow runs

  1. 1

    Run manually

    Starts the workflow manually when you click 'Execute workflow' — used for testing and manual runs.

  2. 2

    Sample CSV

    Sets or transforms workflow data — prepares, renames, or injects fields before the next step.

  3. 3

    Parse CSV

    Runs custom JavaScript to transform or manipulate the data flowing through the workflow.

  4. 4

    Clean rows

    Runs custom JavaScript to transform or manipulate the data flowing through the workflow.

  5. 5

    Remove duplicate emails

    Handles the Remove Duplicates step in this workflow.

  6. 6

    Create clean CSV file

    Handles the Convert To File step in this workflow.

Overview and setup

How it works

Messy spreadsheets are one of the most common reasons people start automating. This workflow shows a complete cleanup pipeline using only built-in nodes, and it ships with a deliberately untidy sample so you can watch every fix happen.

Parse CSV is a small parser written in the Code node that handles quoted values, commas inside quotes and escaped quotes. It turns headers such as "E-mail" or "Signup Date" into snake_case keys.

Clean rows then trims and title-cases names (and flips "Turing, Alan" into "Alan Turing"), lower-cases emails, converts day/month/year, ISO and "Mar 9 2026" dates to ISO format, strips thousands separators from amounts, maps country variants such as "uk" to one spelling and drops empty rows. Problems are recorded in an issues column rather than silently deleted.

Remove Duplicates keeps the first row for each email, and Convert to File writes the result as cleaned-data.csv.

Set up steps

  1. Import the workflow and click Execute workflow.
  2. Compare the output of Parse CSV with Remove duplicate emails to see the changes.
  3. Download the file from Create clean CSV file.

Customise it

  • Replace Sample CSV with a real source: a downloaded file plus Extract From File, an HTTP Request, or a form upload.
  • Edit the date, country and validation rules in Clean rows.
  • Send the clean file by email or upload it to cloud storage instead of downloading it.

n8n nodes used (5 types)

What every node does (6)
  • Run manually (Manual Trigger)Starts the workflow manually when you click 'Execute workflow' — used for testing and manual runs.
  • Sample CSV (Set)Sets or transforms workflow data — prepares, renames, or injects fields before the next step.
  • Parse CSV (Code)Runs custom JavaScript to transform or manipulate the data flowing through the workflow.
  • Clean rows (Code)Runs custom JavaScript to transform or manipulate the data flowing through the workflow.
  • Remove duplicate emails (Remove Duplicates)Handles the Remove Duplicates step in this workflow.
  • Create clean CSV file (Convert To File)Handles the Convert To File step in this workflow.

FAQ

Clean and normalize CSV data with the Code node: questions

How do I import the "Clean and normalize CSV data with the Code node" workflow into n8n?

Copy the workflow JSON from this page, open the n8n editor, click on an empty canvas and paste with Ctrl+V (Cmd+V on macOS). You can also download the .json file and choose Import from File in the workflow menu. Save the workflow, then attach credentials before activating it.

Which nodes and credentials does "Clean and normalize CSV data with the Code node" use?

It uses Manual Trigger, Set, Code, Remove Duplicates and Convert To File. Any node that connects to an external service needs your own credential — open each node after import and select or create one. Trigger, logic and transformation nodes usually need no credentials.

Can it run on n8n Cloud and on self-hosted n8n?

The workflow format is the same on both. If a node appears as unknown or outdated after import, update n8n to a recent version or, on self-hosted instances, install the required community node package. Features such as $env access are available on self-hosted instances only.

How can I customise "Clean and normalize CSV data with the Code node"?

Start by changing the trigger (schedule, webhook or app event) and the destination nodes to match your stack — it is listed under Data Transformation, Engineering. Edit prompts, field mappings and filters in the relevant nodes, use expressions like {{ $json.field }} to map data, and test with a manual execution before activating.

  • +3
    AltFTool originalBeginnerOn a schedule

    GitHub release watcher with duplicate filter

    Keep track of new versions of the tools you depend on without watching every repository by hand. Every six hours this workflow asks the public GitHub API for the latest release of each repository on…

    by AltFTool
    Nodes: 8
  • +3
    AltFTool originalBeginnerOn a schedule

    Website uptime monitor with status alerts

    A lightweight uptime checker you can run on your own n8n instance. Every five minutes it requests each URL on your list and decides whether the site is healthy. The HTTP Request node is set to…

    by AltFTool
    Nodes: 8
  • AltFTool originalBeginnerWebhook

    Webhook JSON validation API endpoint

    This workflow turns n8n into a small, well-behaved JSON API. A Webhook node listens for POST requests on the path contact-intake and hands the response over to Respond to Webhook nodes, so you…

    by AltFTool
    Nodes: 5
  • AltFTool originalBeginnerApp event

    Workflow error alert by email

    Silent failures are the biggest risk once automations run unattended. This is a reusable error workflow: point any of your workflows at it, and whenever one of them fails you get an email with…

    by AltFTool
    Nodes: 3

n8n is a trademark of n8n GmbH. AltFTool is not affiliated with, endorsed by or sponsored by n8n. Community templates are credited to their creators and link to the original listing; AltFTool originals are written and tested by the AltFTool team.