Builder workflows
Advanced: Use Claude Code to Check CSV Columns Before a Recurring Import
Cihan's view: Give Claude Code a read-only column contract, request a dry-run report, and review every missing, extra, or reordered column before an import.
A recurring CSV import can fail quietly when a column is renamed, added, or moved. A small dry-run check gives the owner a clear stop sign before the file reaches another system.
This is Advanced builder content. It is a documentation-based and illustrative Claude Code lesson. The files and expected report are fictional. No Claude Code execution, import, or measured result is claimed.
What you will make
You will create a local checker that compares an incoming CSV header with an expected contract. The report will identify:
- missing columns
- unexpected columns
- columns in a different order
- whether the source file was changed
The checker should report differences only. It should not rename columns, delete data, upload files, or run an import.
No-code alternative
Open the two CSV files in a spreadsheet, place the header rows side by side, and mark missing, extra, and reordered columns manually. Use that option for a one-off check or when your team has not approved a coding session.
Prerequisites
You need Claude Code installed and an approved local terminal session. Anthropic documents that Claude Code can work from a terminal and that permissions control file reads, shell commands, and edits. Read the Claude Code overview and permissions guide before using real data.
Create an empty practice folder with these complete files.
expected-columns.txt
customer_id,email,plan,status,created_at
incoming.csv
customer_id,email,status,plan,created_at,region
c-101,ana@example.test,active,pro,2026-10-21,EU
c-102,omar@example.test,paused,team,2026-10-22,EU
The example includes one extra column, region, and a changed order for plan and status. The addresses use the reserved .test domain.
Three steps
1. Start in the practice folder
Open a terminal in the folder containing only the two files. Confirm the path and list the files yourself. Do not begin in a production export folder.
2. Ask for a dry-run plan
Start Claude Code from that folder and paste this instruction:
Inspect only expected-columns.txt and incoming.csv in the current folder.
Do not edit, rename, move, delete, upload, commit, or import anything.
Do not read files outside the current folder.
Compare the comma-separated expected columns in expected-columns.txt with the first row of incoming.csv.
Create a proposed report named COLUMN-CHECK.md, but stop before writing it.
The report must include:
- expected columns in their expected order
- observed columns in their observed order
- missing columns
- unexpected columns
- whether the order matches exactly
- a clear READY or HOLD decision for this dry run
Treat a changed order as a review item even when both columns exist.
Do not inspect or report values from data rows unless needed to confirm the CSV header.
Before any write, show the exact report text and explain which permission would be needed.
Review the proposed report. If the request to write is not necessary, ask Claude Code to return the report in chat instead. If you approve the local report, allow only the new COLUMN-CHECK.md file.
3. Compare the result with the contract
The expected illustrative report should identify region as unexpected, report no missing columns, note that plan and status are not in the expected order, and set the decision to HOLD until the owner resolves the difference.
That is an expected result from the fictional files, not a reproduced Claude Code output.
Checkable artifact
A useful COLUMN-CHECK.md contains:
Expected: customer_id,email,plan,status,created_at
Observed: customer_id,email,status,plan,created_at,region
Missing: none
Unexpected: region
Order: HOLD, plan and status are swapped
Decision: HOLD
Source files changed: no
The artifact is illustrative. Replace it with values you verify from your own files.
Acceptance checks
The workflow passes when:
- the expected contract is read in its original order
- the incoming header is read in its original order
regionis reported as unexpected- no column is incorrectly reported as missing
- the order difference is visible
- the decision is HOLD, not an automatic import approval
- the two source files remain unchanged
- no external system is contacted
Troubleshooting
Claude Code proposes a rename. Reject the edit and repeat that the task is a report-only dry run.
It treats order as irrelevant. Ask it to compare positions as well as column names. Some importers map by name, while others depend on position.
It scans the whole directory. Stop the session and use a clean practice folder. Do not grant access to a wider path to solve a scope problem.
It says READY because all names exist. Require the exact order check and ask the system owner which mapping the importer uses.
Limits and decision
A header check does not prove that rows are valid, that values use the right types, or that the destination will accept the file. Test the full import separately in an approved environment. Keep credentials and real personal data out of the practice session.
TRY: a disposable sample and a written column contract.
SKIP: unattended imports, production files, and any session that requests broader access than the check needs.
USE: the report as a human stop point before an import.
For a nontechnical starting point, choose your first AI workflow at work. For the weekly practical version, join The Weekly Verdict.