CSV Sample Rows
Extract the first, last, or random sample of rows from a CSV file while keeping headers intact.
O
M
T
Sample rows from a CSV file
Take the first or last N data rows, or draw a reproducible random sample with a seed. The header row is always preserved in the output.
Related: CSV Filter Rows and CSV Dedupe.
Frequently Asked Questions
Does random sampling repeat rows?
No. Each row index is chosen at most once for a given sample size.