Load attachments in Salesforce from SFTP

  • 177Views
  • Last Post 16 November 2018
  • Topic Is Solved
Prasanna Padmanabhan posted this 15 November 2018

Hi Support, 

I want to upload file from sftp and add as an attachment in Salesforce using the connector. 

I am able to set up connectivity, however when I run the task, I ger this error 

An exception has occurred during insert operation, the message returned from the provider is: Unable to cast object of type 'System.String' to type 'System.Byte[]'

Could you please let me know the issue? 

csv has following information 

CaseId File Location

5000k00000A2YPA   test \test.txt



Order By: Standard | Newest | Votes
Mariia Zaharova posted this 15 November 2018

The issue occurs because you are mapping Salesforce Body field (file's content, binary) to CSV column with general text (path to the file). You should send binary data to the Body field.

If you have CSV file with general information (e.g. files descriptions, names, etc.) and files which you want to import to Salesforce as attachments, you can look at this article: https://skyvia.com/resources/docs/importing_accounts_with_binary.htm


In a few words, you should have two files: 

1) One CSV file with general info (you have one already); in the Location (we renamed it to FileName) column store filenames with extensions instead of the paths, for example:

CaseId, FileName 

5000k00000A2YPA,  test.txt

5000k00000A2YPA,  test2.pdf


2) One ZIP archive with the files:




And the mapping should look like this:


If you encounter any  issues with this, feel free to contact us. 


  • Supported by
  • Prasanna Padmanabhan
Prasanna Padmanabhan posted this 16 November 2018

Hi Marria, 

Thanks for getting back to me quickly. Your solution worked. Thank you very much.