Python Excel/CSV Data Cleaning Script (Customizable Template)
Stop manually cleaning the same messy Excel/CSV export every week. This is a ready-to-run Python script that:
- Trims whitespace and standardizes text case (e.g. " john SMITH" -> "John Smith")
- Parses dates stored in different formats into one consistent format
- Fixes numbers that were saved as text (e.g. "$1,234.50" -> 1234.50)
- Removes duplicate rows
- Flags rows with a missing key field (e.g. missing email) for follow-up
Works on any Excel (.xlsx/.xls) or CSV file. You edit a short CONFIG section at the top to match your column names, then run one command. Tested against real messy order-export data (43 rows -> 40 rows after removing 3 duplicates, 7 rows flagged for missing email).
Includes: the script, a full README with setup instructions, and one free round of help getting it configured for your specific file.
Requirements: Python 3.8+, pandas, openpyxl.
Know someone who'd find this useful? Sign up as an affiliate and earn a commission for referrals: https://payhip.com/auth/register/af6a548d9cda3ae
Use code FIRST40 at checkout for 40% off (first 20 buyers).