Messy CSV → tidy CSV, with a report of every change
clean_tableTidies a spreadsheet export: removes duplicate rows, trims whitespace (half-width and full-width — Chinese exports are full of ), unifies the half-dozen ways a cell can say "empty" (NA / null / - / 无), drops empty rows and columns, and can split one column into several. Returns the cleaned CSV plus exactly what changed: rows in, rows out, duplicates removed, cells trimmed per column. It can also transpose rows/columns and unpivot a wide table into a long one. The row arithmetic is verified in code — if in − removed ≠ out, the response says so instead of handing back a table nobody can check. Use when a CSV came out of Excel or an export and needs cleaning before analysis.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ops | No | Comma-separated, default "dedupe,trim,drop_empty,unify_blank". Also available: split_column, transpose (swap rows/columns), wide_to_long (unpivot a wide table into the long format analysis tools expect). | |
| url | No | Link to the CSV. Provide this or text. | |
| keep | No | For wide_to_long: comma-separated id columns to keep as-is. Defaults to the first column. | |
| text | No | The CSV content itself. Provide this or url. | |
| split_by | No | Separator to split on, default a single space. | |
| split_column | No | Column name to split (requires ops to include split_column). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||