AK
← All projects

AI Automation

Automated Excel Data Cleaning Pipeline

Upload a messy customer spreadsheet through a form and get back a validated, de-duplicated file with customer IDs and a summary report.

n8nJavaScriptMicrosoft ExcelGoogle Drive
n8n workflow — form upload, extract from file, JavaScript cleaning code, convert to xlsx, upload to Google Drive

How it flows

  1. 1Upload the Excel file through an n8n form
  2. 2Extract all rows from the spreadsheet
  3. 3JavaScript cleans, validates, and de-duplicates
  4. 4Convert the result back to .xlsx
  5. 5Save clean_customers.xlsx to Google Drive

The problem

Client customer lists arrive with empty rows, duplicate people, mixed capitalisation, extra spaces, broken emails, wrong phone numbers, and dates in four different formats. Cleaning them in Excel by hand takes hours and still misses things.

What I built

A five-node n8n workflow. Most of the work happens in one JavaScript Code node.

Cleaning rules

  • Trim and collapse spaces in every text field.
  • Proper Case for names and cities (john doeJohn Doe, DHAKADhaka).
  • Email — lower-cased and checked against a pattern; john@gmail is rejected.
  • Phone — digits only, must match ^01\d{9}$ (11 digits, starting with 01).
  • Dates — handles YYYY-MM-DD, DD/MM/YYYY, DD-MM-YYYY, May 1, 2025, and raw Excel serial numbers such as 45778. Everything becomes 2025-05-01.
  • Empty rows and rows missing name, email, or phone are removed and counted.
  • Duplicates — a row is dropped if its email or phone was already seen.
  • Customer IDCUST-0001, CUST-0002, … assigned to the clean rows.

Summary report — after the data, the file contains a block with: total rows imported, empty rows removed, missing values removed, invalid emails removed, invalid phones removed, duplicates removed, and the final row count.

Result

A team member uploads a file and receives clean_customers.xlsx in Google Drive a few seconds later. Every row in it is valid, consistent, and unique.