+ Start a Discussion
J2theCJ2theC 

CSV file parsing

I am retreiving information from salesforce using the REST Bulk API to get CSV files with some data. The data I get from salesforce comes with some file characteristics that needs to be parsed. The only place I get information about the file format is on the bulk API's documentation, on the "Valid CSV Record Rows", that says the following: 

 

• The delimiter for field values in a row must be a comma.

• If a field value contains a comma, a new line, or a double quote, the field value must be contained within double quotes: for example, "Director of Operations, Western Region".

• If a field value contains a double quote, the double quote must be escaped by preceding it with another double quote: for example, "This is the ""gold"" standard".

• Field values aren't trimmed. A space before or after a delimiting comma is included in the field value. A space before or after a double quote generates an error for the row. For example, John,Smith is valid; John, Smith is valid, but the second value is " Smith"; ."John", "Smith" is not valid.

• Empty field values are ignored when you update records. To set a field value to null, use a field value of #N/A. Name,Mother_Of_Child__r.External_ID__c CustomObject1,123456 Subject,Priority,Status,Lead:Who.Email,Owner.Id Test Bulk API polymorphic reference field,Normal,Not Started,lead@salesforcesample.com,005D0000001AXYz 18
Preparing Data Files Sample CSV File

• Fields with a double data type can include fractional values. Values can be stored in scientific notation if the number is large enough (or, for negative numbers, small enough), as indicated by the W3C XML Schema Part 2: Datatypes Second Edition specification.

 

 

Now, this is specific to generating CSV files, is there such thing as a documentation with details about all the possible formats the file can follow?