SFTP: Scripting and Automation/ Importing data from your HR system


NOTE—for setup information on using SFTP to import data and download reports, see this article


Using SFTP automation to import data from your HR system

If you have already exported data from your HR system via CSV (for example: from AD) and you also have an SFTP account, you can create script files and set up tasks to automatically upload your files to Jostle as follows:


Uploading files to your SFTP Account (for Windows)

For this you'll need to:

  • Create a .txt file that will contain the script
  • Create a .bat file which will run the script
  • Create a task to run your .bat file on a schedule

1. Create a .txt file that will contain the script

Here's an example:

option batch abort
option confirm off

open s -privatekey="C:\Keys\privateKeyToSFTP.ppk"
put C:\exportUsers\jostleContributors.csv /jostle/input/

username = the username we provided to you once your SFTP account was created

path to private key = the path to where your private key is stored (put the private key path inside the quotations)

local drive path = the path to where the upload .csv files are held (don’t put the local drive path in quotations)


2. Create a .bat file which will run the script

In this example we’re using WinSCP to connect to our SFTP server. If you want to use WinSCP you need to install it in your server.

"C:\Program Files (x86)\WinSCP\" /script=script.txt


3. Create a task to run your .bat file on a schedule

  1. Open Task Scheduler
  2. Once it's open, click Create Task
  3. Go through the tabs of the Task Setup:

Task Setup

1. On the General tab:
     i. Add the Name of the Task
     ii. Modify any of the security option (if necessary)
2. On the Triggers tab:
     i. Click “New”
     ii. Schedule the frequency and time you’d like the script to run
3. On the Actions tab:
     i. Click “New”
     ii. Choose the “Action” as “Start a program”
     iii. In the Program/script section, search for the .bat file you created
4. The Conditions & Settings tabs are optional

Once you have finished configuring the task click OK.



To make sure that the fields from your HR system get matched up properly with Jostle’s fields you’ll need to create a mappings.csv file with your system's attributes in the first column and the corresponding Jostle fields in the second column. NOTE—if using SFTP, the mappings file will be stored in the “config” folder. 




Scripting/Automation notes

WinSCP references:

To set the Host Key for your scripts or code:

  • When scripting you can specify the expected fingerprint using  -hostkey switch of an open command. 
  • With .NET assembly, use SessionOptions.SshHostKeyFingerprint property

NOTE—using “*” for hostkey is not best practice because your script would be trusting any key, which could make you susceptible to man-in-the-middle attack.

You can get Jostle's Host Key by connecting to our SFTP server manually with WinSCP and then navigating to Session > Server/protocol information 

Server and Protocol Information Dialog



Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request


Please sign in to leave a comment.