I am using data loader from .Net web application where users are uploading the csv file of records. I need to upload those files at run time through data loader. I tried evaluating this and as per my understanding i need to give physical path of CSV in process-conf.xml which i can't manipulate at run time. Can i pass the CSV file name through command prompt while executing the command?


java -cp ..\dataloader-28.0.2-uber.jar -Dsalesforce.config.dir=..\conf com.salesforce.dataloader.process.ProcessRunner process.name="process name" dataAccess.name="path of your csv file"

You can use above command.


Yes your correct, the full path location of the CSV file has to be specified in the beans contained with the process-conf.xml file. And i assume your .Net code is receiving the uploaded CSV file from the user and placing it either in memory or in a temporary location on the web server. I've reviewed the documentation again since its been a while since i used, but unfortunately there is no option to pass this in any other way.

I can see three alternatives that might help here though...

  • Dynamically copy and then edit the process-conf.xml file. Leveraging a temporary directory who's name is unique to the upload (in order to ensure isolation from users also perform this task concurrently). Copy a template version of the process-conf.xml file and any other required configuration files into this directory. Using the XML parsing and editing support in .Net to locate the XML element describing the CSV file location and update it. When invoking the Data Loader command line, give as the first parameter the location of your temporary directory and as the second the name of your bean process to run the import job.
  • Leverage the Salesforce Bulk API to upload the CSV Data. This is big departure from your current strategy i know. But invoking a Java based command line tool, which is really aimed at scheduled single user invocation (hence your challange), from a multi-user web based interface written in .Net is likely going to continue to present more challenges down the road. So i wondered if you have considered the Salesforce Bulk API? This API provides a means for you to directly pass the CSV file into the API calls. There is an Java example of it but not as far as i can find one in .Net. Depending on how experienced you are in calling REST API's and API's in general you might be able to port the Java example given in the documentation. You can leverage the toolkit referenced below to perform the login aspects.
  • Homebrew 100% .Net Solution. Depending on how fixed your mapping requirements are you might want to consider simply parsing the CSV file yourself and using the Salesforce REST API to insert the records yourself and keep the solution completely .Net based. Salesforce has recently released a set of pre-built assemblies for connecting to its API's, through the Salesforce Toolkits for .Net.

Hope this helps!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.