Here is what i tried.
- First, parse the first 10-20 lines of a CSV file
- Second, Count the number of delimiters [commas, tabs, semicolons and colons] in each line
- Third, Compare the number of delimiters in each line. If you have a properly formatted CSV, then one of the delimiter counts will match in each row. But if CSV file has same number of actual delimiter (suppose comma) and other delimiter (suppose semicolon or space) then it gives problem....
Those are all possible approaches, you can also use the outcome of this as a default that the user can change if needed.
Upon reading data, if you get an exceptionally high number of errors due to data type mismatches, you could retry.