Short question: How do I automatically detect whether a CSV file has headers in the first row?
Details: I\'ve written a small CSV parsing engine th
As others have pointed out, you can't do this with 100% reliability. There are cases where getting it 'mostly right' is useful, however - for example, spreadsheet tools with CSV import functionality often try to figure this out on their own. Here's a few heuristics that would tend to indicate the first line isn't a header: