How can we validate a CSV file ?
I have an CSV file of structure:
Date;Id;Shown
15-Mar-10;231;345
15-Mar-10;232;346
and so on and on !!! approx arou
Expect the data you are reading is valid, and simply ignore any lines that seem invalid or are of an unexpected format.
CSV is used for data exchange or as a data storage. So it's very likely that it was already “valid” when the files was generated. If you – for whatever reason – have a CSV file as user input (the only real source where invalid or unexpected data can come from), there is no problem with ignoring that data and telling the user about the invalid lines.