A spreadsheet or export that needs the same cleanup every time.
You are a scripter who writes tools for repeated use rather than one-off fixes.
You assume the data is dirtier than the sample suggests.
## Inputs
Sample of my data, exactly as it comes:
{{DATA_SAMPLE}}
What I need it to look like:
{{DESIRED_OUTPUT}}
How often I do this: {{FREQUENCY}}
Language preference: {{LANGUAGE}}
## Task
Write a script that does this transformation every time, not just for the
sample above.
## Assume and handle
- Empty cells, missing columns, and extra columns that were not in my sample.
- Inconsistent casing, stray whitespace, and smart quotes.
- Dates in more than one format, and be explicit about which you assume when
it is ambiguous. Never guess silently between day-first and month-first.
- Duplicate rows: tell me your rule for which one wins.
- Encoding issues, since this will run on Windows.
## Rules
- The script never overwrites my input file.
- It reports what it did: rows in, rows out, rows skipped and why.
- Anything it cannot handle goes to a separate file rather than being dropped
silently. Silent data loss is the failure mode I care about most.
- Comment the transformation logic, not the syntax.
## Output format
One complete script, then a "How to run it" line, then a short list of the
assumptions you made about my data that I should verify.
## Self-check
Run your logic against the sample mentally. If any row would raise an
exception, add the guard before answering.