I am trying to insert data from csv file into Salesforce (using Python file).

Bottom is portion of Python script to fetch the data from csv file and into Salesforce database.

for line in file: 
    line = line.strip()
    line_parts = line.split(",")

    if not line_parts[0] in 'Date':
        sf.Table__c.create({'Date__c': line[0], 'Survey__c': line[1]})

The output format of 'Date' is 7/23/2017 .

What should be the format inside csv file so that it would take into "Date" or "Date Time" format in Salesforce?

I am trying to use Date and Time such as "7/23/2017 9:00:00 AM".

When I tried with this format in csv, it generated this error

Response content: [{u'errorCode': u'JSON_PARSER_ERROR', u'message': 
u'Cannot deserialize instance of date from VALUE_STRING value Date or 
request may be missing a reuqired field at [line:1, column:17]'}}

I even tried with simple "7/23/2017" format, and still getting the same error.

I guess the challenge is how to format the cell as acceptable format as illustrated on the bottom.

1 Answer 1


The "Date" field acceptable formats



"Date Time" field acceptable formats

  • YYYY-MM-DD hh:mm:ss
  • YYYY-MM-DDThh:mm:ssZ
  • YYYY-MM-DDThh:mm:ss.sssZ
  • I tried to find these formats, but I do not find that at CSV file.
    – Java
    Jul 23, 2017 at 1:07
  • I dont understand ->" I do not find that at CSV file "
    – glls
    Jul 23, 2017 at 1:09
  • I am looking at Format Cell options inside Excel/CSV file, but I cannot find these.
    – Java
    Jul 23, 2017 at 1:11
  • To change the date format, you need to open the spreadsheet, highlight the column and right-click and select 'Format Cells'. Choose 'Date; then highlight 03/14/01, while that is highlighted click on 'Custom'.
    – glls
    Jul 23, 2017 at 1:14
  • I got to where it is 03/14/01, but when I went to 'Custom' , I do not see option of YYYY-MM-DD from the list, but I typed in YYYY-MM-DD. Now, it is indicated as 2017-07-23 on csv file. I saved the file. But, when I ran the Python file, I still get the same error.
    – Java
    Jul 24, 2017 at 15:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .