Monday, August 9, 2010

Salesforce CSV Format for Report Exports Is Not IETF RFC 4180-compliant

At the time of writing this post, I believe the published standard for CSV file formatting is the IETF RFC 4180.

Also at the time of writing this post, I believe that the Summer 2010 version Salesforce does not produce IETF RFC 4180-compliant CSV files for exported reports.

Here are a few differences in the Salesforce CSV file:
  • Salesforce uses a single LF ('\n') to start a new row of data instead of a CRLF ('\r\n').

  • Salesforce exports line breaks in street addresses with just a LF instead of the CRLF specified by the RFC.


A few more noteworthy considerations for the Salesforce report CSV files:
  • All values are delimited with double-quotes.

  • Salesforce does double double-quotes for values that contain the double-quotes character, as stipulated in the RFC.

  • For Text Area fields, Salesforce does convert line breaks in the field value to CRLF sequences, with the exception of native Street fields.

  • There is a footer in the CSV file that does not contain any data at all, which may complicate straight data imports into other systems or programs like Microsoft Access.