How to handle “,” comma within a field in csv file while importing it?
I am trying to import a csv file and parse the csv file but don’t know how csv escape comma? I have the code working fine, except where we have a "," within a field in the csv. While reading the CSV its considering the comma as the field delimiter as it should. How do data loaders handle this?
Data Loader cannot handle this implicitly because there is no logical path to follow. In case your Data Loader CSV file for import will contain commas for any of the field content, you will have to enclose the contents within double quotation marks " ". Data Loader will be able to handle this. For example,
Column_1__c,Column_2__c,Column_3__c AAA,"BBB,CCC",DDD
If you are creating the import CSV in Excel, the quotation marks will be inserted automatically by Excel whenever a comma is detected in any cell - Saving the CSV in Excel and opening the same in Notepad reveals the enclosing quotation marks for cells containing commas. If the value contains a comma, newline, or double quote, then the String value should be returned enclosed in double quotes. Any double quote characters in the value should be