[SalesForce] Multiple lines when exporting data from salesforce into csv. (DataLoader)

I have been stuck with the following frustrating issue for some days, I hope you can help.

Using Salesforce Data loader I wish to export some objects (Accounts, Contacts, Opportunities) and import them into a sandbox. When I export the Accounts, my csv file gets a strange format for fields that have line breaks. For example querying ID, BillingStreet, BillingCity gives the following csv for one record:

"ID","BILLINGSTREET","BILLINGCITY"

"0012213140hL7LVAA0", "21 Whitetown Road

Haudack","New York"

The same happens for any field I export that have line breaks, Shipping Street, text areas etc. Have anyone encountered this issue and found a solution? It has been a while since I used the data loader, but don't remember having this issue ever.

Any help is greatly appreciated.

Best Answer

That's standard CSV format. Any program that understands CSV will correctly parse the file. When a cell starts with a quotation mark, it must end with a quotation mark. Everything in between, including commas and new line characters, are part of the cell's data. There's nothing strange about the output. Try loading the file in Excel, or reading it into a database, and you'll see it works as expected.

Also, see RFC 4180, which is considered the standard for CSV. Note that a RFC is usually modeled on formats already found in the wild at the time of writing, as many formats often converge to a de facto standard by consensus far before a formal standard is written.

Related Topic