Add to Claude

Guides · For agents

Change a column's value where a condition is true

Tools: sift_fix_dry_run, sift_fix_apply, sift_fix_undoWorks with Claude Code

Ask your agent to run Sift's set_if fix: name the column, the new value and the condition, like an IF-then rule in a spreadsheet. Only rows that meet the condition change. In the test bookings file, the 2 pending bookings of 4 nights or more are set to review.

Ask your agent

With Sift connected (setup takes three steps), paste this and swap in your own paths.

Use Sift with /path/to/rules.bookings.json on /path/to/bookings_export.csv. Dry run set_if on the status column: set it to review where status is pending and nights is 4 or more. Tell me how many rows met the condition, then apply it if I say yes.

Your agent writes the condition like this: {"all": [{"field": "status", "op": "eq", "value": "pending"}, {"field": "nights", "op": "gte", "value": 4}]}.

2 of 10 rows is 20%, exactly the usual limit in this rules file ({"guardrails": {"stop_if_share_of_rows_changed_over": 0.2}}), so it goes through. Sift only stops when the share is over the limit. A condition that picks out more rows needs a higher limit, in the rules file or for one job with maxShareChanged.

What Sift sends back

Rows that met the condition2: BK-1006 (4 nights) and BK-1008 (7 nights)
Rows that would change2 of 10 (20%)
Left alone8, including BK-1003, pending but 1 night
After applyA new file, a receipt and a changes-only file. The original is not touched.
After undoThe original rebuilt, matching byte for byte

The receipt keeps the value and the condition, so anyone can see which rule changed which rows.

What a condition can say

Equal or not equal, in or not in a list, blank or not blank, and greater or less than a number. Combine them with all, any and not. Text must match exactly.

Date conditions work both ways: within_days (0 to N days before the date you give), older_than_days, and due_within_days (0 to N days after it, for things due soon). Sift never uses today's clock, so give an as-of date. A date that could be either way round is flagged, and its row is left as it is.

What to do next

Questions

Can the condition use another column?
Yes. The condition can read any column of the same file, and the change goes in the column you name.
Can it use today's date?
No. Sift never uses the clock. Give an as-of date, so the same run gives the same answer tomorrow.
Does it work on an Excel file?
Fixes work on CSV, which is what makes the undo exact. Save the sheet as CSV first, then point your agent at the CSV.

One file, no agent? Clean a file by hand in your browser, with nothing uploaded.

More guides

Guide Fill blank cells in a CSV with a value Guide Find and replace many values at once with a lookup table Guide Score and qualify a lead list