A Python script that automates the cleaning and preprocessing of Excel files. This tool removes empty rows, normalizes column names, and trims whitespace from cells.
- Remove completely empty rows
- Normalize column headers (lowercase, trimmed)
- Trim leading/trailing whitespace from text cells
- Generate cleaned Excel output file
- Python 3.8
- pandas
- openpyxl
git clone https://github.com/2001J/Excel-automation-script.git
cd Excel-automation-scriptmacOS/Linux:
python3 -m venv venv
source venv/bin/activateWindows:
python -m venv venv
venv\Scripts\activatepip install -r requirements.txt-
Place your Excel file in the project directory as
sample_input.xlsxor modify theinput_filevariable in the script. -
Run the script:
python clean_excel.py- The cleaned output will be saved as
cleaned_output.xlsx
Excel-automation-script/
├── clean_excel.py # Main script
├── requirements.txt # Python dependencies
├── sample_input.xlsx # Sample input file
├── .gitignore # Git ignore rules
└── README.md # Documentation
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.