Data Transformation
X21 excels at reshaping messy data into clean, analysis-ready tables. Here are common transformation scenarios and the tools involved.Cleaning Imported CSVs
- Prompt: “Clean the imported CSV in
RawDatasheet. Remove blank rows, trim whitespace, and convert dates in column C to ISO format.” - Operations:
read_valuesto inspect the dataset.remove_rowsto drop blank lines.write_valuesto insert corrected values or formulas for trimming.write_formatto apply consistent date formatting (yyyy-mm-dd).
- Outcome: Claude summarises what was cleaned and highlights any anomalies that require manual attention.
Normalising Columns
- Task: “Split the
Full Namecolumn intoFirst NameandLast Name, and moveEmailnext toLast Name.” - Workflow:
add_columnscreates new columns for first/last names.write_valuesinserts formulas (e.g.,=TEXTBEFORE(A2," ")) anddrag_formulafills them down.remove_columnsdeletes the original combined column once verified.write_formatensures consistent casing or trim operations.
Pivoting Data
- Claude can recompute pivot-like summaries by reading the source table and writing an aggregated output to a new sheet.
- Example prompt: “Summarise total spend by Department and Month. Include grand totals.”
- Tools:
add_sheets,write_values, optional chart creation for the pivot result.
Merging Reference Data
- Attach a lookup table or reference PDF and instruct Claude to align it with the workbook data.
- Claude reads both sources, matches keys, and writes enriched rows using
write_values. It may generate helper formulas (VLOOKUP/XLOOKUP) when necessary.
Preparing Data for Export
- Request: “Convert this table to a CSV-friendly format with headers on row 1, no formulas, and consistent numeric precision.”
- Steps:
write_valuesto copy values-only versions of formula results.write_formatto set number formats and alignments.- The assistant confirms the output is ready for export (you can then use Excel’s Save As or a macro for final export).

