Catch CSV row-width drift before it breaks an import
A spreadsheet export can look ordinary but break a bulk import when a line has fewer or more columns than the header. This is a structural problem, separate from missing values or duplicate business identifiers.
Consider this entirely synthetic sample:
order_id,amount,currency 1001,29.50,USD 1002,19.00 1003,"39,00",EUR,EXTRA 1004,10.00,USD
Enter fullscreen mode
Exit fullscreen mode
Line 3 has only two fields. Line 4 has four. The comma inside the quoted amount 39,00 belongs to a single field, and the extra field is a separate problem.
Reproducible validation with standard-library Python
import csv from io import StringIO
sample = """ order_id,amount,currency 1001,29.50,USD 1002,19.00 1003, " 39,00 " ,EUR,EXTRA 1004,10.00,USD """
reader = csv .…