Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

Sales Normalizer

A tool to automatically clean and merge multiple raw sales CSV files into one standardized, duplicate‑free CSV.

This script:

  • Reads all CSV files from a folder
  • Standardizes inconsistent column names
  • Cleans messy headers
  • Parses dates
  • Converts numeric fields
  • Removes blank rows
  • Removes duplicates
  • Merges everything into a single cleaned_sales.csv

🚀 Features

✔ Accepts entire folder of CSVs ✔ Handles large datasets (50k+ rows) ✔ Auto column normalization ✔ Duplicate auto‑removal ✔ Auto date conversion ✔ Custom duplicate rules ✔ CLI options ✔ EXE build support ✔ Can be scheduled to run automatically


📦 Requirements

  • Python 3.9+ recommended
  • pandas

🛠 Installation

Create a virtual environment

python -m venv .venv

Activate venv

Windows PowerShell

.venv\Scripts\Activate.ps1

Windows CMD

.venv\Scripts\activate

Install package

pip install pandas

▶ Run Script

Basic

python normalize_sales.py --input-dir raw_csvs --output cleaned_sales.csv

With duplicate subset

python normalize_sales.py -i raw_csvs --duplicate-subset order_id,date

Recursive

python normalize_sales.py -i raw_csvs --recursive

Dry-run

python normalize_sales.py -i raw_csvs --dry-run

Show CLI help

python normalize_sales.py -h

🧰 Build EXE

Install PyInstaller:

pip install pyinstaller

Build:

pyinstaller --onefile normalize_sales.py

EXE will appear inside:

dist/normalize_sales.exe

⏰ Auto‑Run (Windows Task Scheduler)

  1. Open Task Scheduler
  2. Create Basic Task
  3. Trigger: Daily
  4. Action: Start a Program
  5. Program/script:
C:\path\to\normalize_sales.exe
  1. Add Arguments:
--input-dir "C:\path\to\raw_csvs" --output "C:\path\to\cleaned_sales.csv"
  1. Start In:
C:\path\to\dist
  1. Save

Now your cleaner runs automatically.


📁 Folder Structure (Recommended)

sales_project/
│   normalize_sales.py
│   normalize_sales.spec        (auto‑generated by PyInstaller)
│   README.md
│   cleaned_sales.csv           (output)
│   .gitignore
│
├── raw_csvs/                   (input CSVs)
│      file1.csv
│      file2.csv
│
├── dist/                       (exe output)
│      normalize_sales.exe
│
├── build/                      (pyinstaller build cache)
│
└── .venv/                      (virtual environment)

Note: normalize_sales.spec is generated automatically during EXE build and can be regenerated anytime.


📦 Future Enhancements

  • Web UI
  • GUI App
  • Auto‑email reports
  • Cloud sync

End.

About

"CLI tool to clean, standardize, and merge messy sales CSVs into one duplicate-free file"

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages