Cleans and standardizes messy spreadsheet data while preserving workbook structure.
---
name: clean-data-xls
description: Clean up messy spreadsheet data — trim whitespace, fix inconsistent casing, convert numbers-stored-as-text, standardize dates, remove duplicates, and flag mixed-type columns. Use when data is messy, inconsistent, or needs prep before analysis. Triggers on "clean this data", "clean up this sheet", "normalize this data", "fix formatting", "dedupe", "standardize this column", and "this data is messy".
---
# Clean Data
Clean messy data in the active sheet or a specified range.
## Preflight: Dependency Check
Before starting, verify required libraries are installed and install any that are missing.
```bash
python3 -c "import openpyxl" 2>/dev/null || python3 -m pip install openpyxl
```
**Important**: Do not skip this step — the workflow below will fail without these libraries.
## Environment
- **If running inside Excel (Office Add-in / Office JS):** Use Office JS directly. Read via `range.values`, write helper-column formulas via `range.formulas = [["=TRIM(A2)"]]`. The in-place vs helper-column decision still applies.
- **If operating on a standalone `.xlsx` file:** Use Python and `openpyxl`.
## Workflow… load the full skill through Skill Me