Clean data with ChatGPT without losing codes or guessing dates

An item code such as 0042 can become 42 when a file is treated as a table of numbers. Before asking ChatGPT to clean a dataset, define which columns are identifiers, which are quantities, and which values need a source check. Request a proposed change log before accepting the cleaned copy.

OpenAI's file workflow documentation explains supplying source data, expected structure, output type, and review criteria. Available file and preview tools depend on the surface. For a small cleaning task, you can start with a permitted sample pasted as text and review the proposed transformations before processing the full file.

Define what each column means

This original fictional CSV contains three stock-location records. It is teaching data, not a live warehouse export:

row_id,item_code,received_date,bin,quantity
A,0042,2026-03-04, north-1 ,8
B,0420,03/04/2026,NORTH-1,5
C,0042,,South-2,0

The supplied schema says item_code is a four-character text identifier, bin is a location label, and quantity is a nonnegative whole-number count. Repeated item codes are allowed because the same item can be in different bins. No date convention has been supplied for slash-formatted dates.

That last gap changes what “clean” can mean. 03/04/2026 could describe March 4 or April 3 under different conventions. It should remain unresolved until the source owner supplies the convention or the actual date. The nearby unambiguous date does not prove the intended reading.

Approve a narrow set of transformations

For this exercise, the owner approves trimming outside spaces and using uppercase for bin labels. They do not approve removing leading zeros, deleting repeated item codes, or filling missing dates.

Row and field Raw value Proposed value Reason
A, bin north-1 NORTH-1 Approved whitespace and case normalization
B, received_date 03/04/2026 Unchanged, flagged ambiguous Date convention not established
C, received_date Blank Blank, flagged missing No source value supplied
A and C, item_code 0042 0042 Identifier is text; repeated codes allowed
C, quantity 0 0 Zero is a supplied count, not missing data

These expected changes were authored for the fixture. They are not a report of a ChatGPT execution. A real dataset needs its own schema and allowed transformations.

Copy this review-first cleaning prompt

Help clean this dataset while preserving the source.
Dataset purpose and one-row meaning: [ENTER]
Columns, data types, allowed values, and identifier rules: [PASTE]
Date/number conventions established by the source: [PASTE OR UNKNOWN]
Approved transformations: [LIST]
Missing-value markers and duplicate-record rules: [ENTER]
Permitted sample with stable row IDs: [PASTE]

First profile the sample and propose a change log containing row ID,
field, original value, proposed value, and reason. Flag ambiguous
dates and conflicting values. Wait for my approval before transforming.
Preserve identifiers as text, including leading zeros. Keep zero,
blank, and unknown distinct. Do not infer missing facts or remove
records merely because an identifier repeats.

After approval, produce a separate cleaned copy and the actual change
log. Report rows before/after and unresolved values. Preserve the raw
file. Explain how to retain the identifier column as text in my target
application: [APPLICATION AND OUTPUT FORMAT]. Do not overwrite sources.

The final line matters because CSV files do not enforce column types. A correct 0042 in the file may still display as 42 if the receiving application imports it as a number. Use that application's import controls to set the code column to text and inspect the imported result.

Check the saved copy, not just its preview

For this fixture, all three row IDs should remain. Codes A and C should still read 0042, B should read 0420, and the quantity total should remain 13. Those checks catch unintended deletion or numeric changes, but they do not resolve B's date. Check both the preserved raw value and its unresolved flag.

Reopen the actual output in the intended application. Inspect leading zeros, blank cells, date display, and the change log. If the file looks different after import, correct the import or output format before relying on it.

Once the schema decisions and transformations are accepted, the ChatGPT data-analysis guide covers checking calculations and denominators. Keep the raw source and approved cleaning record together, so someone reviewing the analysis can tell which values came from the source and which were deliberately normalized.

Keep reading