Skip to content

uwe-braig/sf-dataloader-cli

Repository files navigation

Command Line Engine for Salesforce Data Loader

What is it?

A PowerShell module that simplifies working with the Salesforce Scripted Data Loader.
It provides a clean command-line interface for running Data Loader jobs without manually creating XML configuration files or relying on the GUI.

Why would you need it?

Salesforce Data Loader offers two usage modes:

  • GUI mode – easy to use, but limited when it comes to repeatable or automated tasks.
  • Scripted mode (a.k.a. Scripted Data Loader) – powerful, but requires hand-crafted XML configuration files and is inflexible for ad‑hoc changes.

This module fills the gap by enabling you to run Salesforce Data Loader directly from the PowerShell command line (What is PowerShell?) — ideal for both ad‑hoc operations and repeatable automation.

It provides:

  • Straightforward commands and easy-to-remember aliases for EXTRACT, INSERT, UPDATE, UPSERT, and (HARD) DELETE
  • Simple switching between SOAP API and Bulk API (serial or parallel), including command-line control of batch size
  • Automatic creation of mapping files in many scenarios
  • Encapsulated Salesforce authentication, including
    • generating key files and encrypted password storage (username + password + security token),
    • optional reuse of authentication handled by the Salesforce SFDX CLI
  • Full PowerShell integration: help pages, tab completion, approved verbs, and consistent command naming

How does it look like?

Example: Copying Leads Between Orgs

For more examples and command reference, see the Wiki Pages.

Step 1: Authorize the Source Org

Using the default org of your SFDX project:

$MySourceOrg = sfauth

Step 2: Authorize the Target Org

Example for a Sandbox org, prompting for password and security token:

$MyTargetOrg = sfauth MyUserName@MyCompanyName.com -ConsoleInput -InstanceUrl https://test.salesforce.com

Step 3: Extract all Lead Records from Source Org

Extracts all Leads into the file Lead.csv - that is the default file name derived from the Object Name.

sfextract $MySourceOrg Lead "SELECT Id, FirstName, LastName, Company FROM Lead"

Step 4: Insert all Leads to Target Org

Imports the Leads from Lead.csv.
A default mapping file (.sdl) is automatically created based on the CSV headers:

sfinsert $MyTargetOrg Lead

How to get it?

Prerequisites

Mandatory

Optionally

  • Salesforce CLI if you want to use the authentication methods provided by SFDX.

Download and Install SfDataloaderCli PowerShell Module

  • Download the .zip file of the latest stable version from Releases.
  • Extract the files to a target directory of your choice, e.g. D:\sf-dataloader-cli-0.0.1-beta
  • From the Data Loader .zip file (see prerequisites above), locate the Data Loader .jar file: e.g. in the dataloader_v58.0.2.zip this would be the file dataloader_v58.0.2.jar.
  • Copy this .jar file to the corresponding directory in the PowerShell module directory, e.g. to D:\sf-dataloader-cli-0.0.1-beta\dataloader

Import the SfDataloaderCli module into your PowerShell session

  • Open a PowerShell console window.
  • Run Import-Module D:\sf-dataloader-cli-0.0.1-beta\dataloader\SfDataloaderCli.psd1.

Get Started!

See the Wiki Pages on how to get started.

About

Command Line Interface for Salesforce Data Loader: A PowerShell wrapper to easily use Scripted Data Loader via command line.

Topics

Resources

License

Stars

Watchers

Forks

Contributors