Common Pitfalls When Working with CSV
Covers the most common causes of CSV data getting corrupted, such as delimiters, quotes, and encoding.
CSV looks simple, but it has many dialects. The delimiter is often a semicolon or tab rather than a comma, and depending on locale settings Excel may automatically use a semicolon.
When a value contains a comma, line break, or quote, you must wrap it in double quotes and escape quotes by doubling them. If you don't follow this rule, columns shift or rows break.
CSV also has no type information, so numbers and booleans can all be read as strings, and it cannot express hierarchical data. When converting nested JSON to CSV, you have to account for loss, such as placing nested values as strings inside cells.