List workflow ยท CSV records

Shuffle CSV rows without splitting quoted line breaks

Published:

Shuffle complete CSV records, not physical lines. Use a CSV-aware row shuffler that keeps the header separate. If you use our line-based List Randomizer, shuffle record IDs only, then retrieve each complete record from the original CSV. Pasting the whole CSV into it does not import a table.

Keep a copy of the source file. A quoted field can contain a comma, doubled quotation marks or a line break. RFC 4180 describes those conventions; they are not new techniques introduced by this guide. The practical question is whether your chosen workflow preserves the fields together.

What did the same input produce?

We tested that boundary in a browser on October 27, 2026. Our synthetic input has columns slot, item and note, with three records C01, C02 and C03. C01 contains Map, north and a note with Read on one line and then draw on the next. C02 contains Quote "pair". These are test labels, not participant details.

Three records survived. In csvkit.org's CSV Shuffle, we pasted the complete input, left shuffle selected and entered seed roster-audit-20261027. Its downloaded CSV ordered the slots C03, C01, C02.

Parsing that file with Python's csv reader recovered the three original field lists, including the embedded newline. Applying the same settings again returned the same text in that session.

Our List Randomizer displayed five entries for the identical input. The download assigned input entries 5, 2, 3, 4, 1 to the new positions. The header became an ordinary item at position five.

C01's record was split: its first fragment occupied position two, and then draw" occupied position three. The download remained a valid Position, Input entry, Item table, but it was not a shuffled version of the original three-record table.

The ID-only route recovered three intact records. We entered C01, C02 and C03 in the List Randomizer. Its actual saved order was C02, C01, C03.

A separate local script parsed the original CSV, looked up those IDs and wrote their complete records in that order. Every field in the reopened file matched its source record. C01's comma and two-line note stayed together. The script checked the downloaded files, rather than predicting a random order.

How do you keep a line shuffler away from CSV fields?

For your own file, use a unique ID per parsed record. Save only those IDs in the accepted order. Check that none is missing or repeated, then reorder whole parsed records by that list and write the header once. The replay instructions include the local Python check used for our saved files. They require Python; this page does not run a CSV importer.

Which differences matter?

Compare decoded fields, not byte-for-byte formatting. A CSV writer can change optional quoting or line endings while preserving a field. For this test, One line lost unnecessary surrounding quotes in the CSV-aware output; its decoded value stayed the same. Do not delete an intentional newline merely to make a line counter agree.

Download the input, both raw workflow outputs, the ID-only order, the rebuilt CSV and the replay instructions below. The files preserve this observation. Another unseeded draw can produce a different order; the three-record versus five-entry distinction is the reproducible boundary being checked, not a promise about every tool or CSV dialect.

Observed workflows: the same three-record CSV becomes five line entries; shuffling three IDs and restoring parsed records keeps three complete records.
Controlled-input browser observations, October 27, 2026. Random orders can vary.

Files and replay

Parser reference: Python csv documentation. Observed service: csvkit.org CSV Shuffle.