How to Clean CSV Data with AI

An exported CSV can contain missing values, inconsistent dates, or duplicate records. Give GRACE a copy of the export and describe how the receiving system expects to read it. The sandbox can inspect the file, apply explicit rules, and return the CSV alongside a record of the changes.

Inspect the CSV and define the output

Ask for a profile of the headers, delimiter, row count, and columns with blank or mixed values. Include a sample of the required output or a schema from the system that will import it.

Treat order numbers, postal codes, and similar identifiers as text so they retain leading zeros. State the date format explicitly. Ambiguous dates such as 03/04/2026 should go to a review file unless the source format is known.

Write a CSV cleanup brief

Use a separate output file and ask GRACE to explain the rules it applied. Keep duplicate rows for review when the fields disagree.

Read orders.csv and leave it intact. Trim whitespace in the email column and preserve order_id as text. Convert unambiguous dates to YYYY-MM-DD. Write clean.csv and a separate review.csv with the original row number and the reason each row needs review. Report input, output, and review row counts.

Check row counts and sample the changes

Reconcile the input row count against the cleaned rows and the rows set aside for review. If your brief allows exact duplicates to be dropped, ask for the number dropped and include it in the reconciliation.

Check a few records with leading zeros, quoted commas, or blank fields against the original. Test the cleaned file in the receiving system’s preview or import a small sample before loading the full export.