Salesforce Data Loader Guide
Salesforce Data Loader Guide
@salesforcedocs
Last updated: March 6, 2019
© Copyright 2000–2019 salesforce.com, inc. All rights reserved. Salesforce is a registered trademark of salesforce.com, inc.,
as are other names and marks. Other marks appearing herein may be trademarks of their respective owners.
CONTENTS
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
CHAPTER 1 Data Loader
Data Loader is a client application for the bulk import or export of data. Use it to insert, update,
EDITIONS
delete, or export Salesforce records.
When importing data, Data Loader reads, extracts, and loads data from comma-separated values Available in: both Salesforce
(CSV) files or from a database connection. When exporting data, it outputs CSV files. Classic (not available in all
orgs) and Lightning
Note: If commas aren’t appropriate for your locale, use a tab or other delimiter. Specify your Experience
delimiter in Data Loader Settings (Settings | Settings).
Available in: Enterprise,
You can use Data Loader in two different ways: Performance, Unlimited,
• User interface—When you use the user interface, you work interactively to specify the Developer, and
configuration parameters, CSV files used for import and export, and the field mappings that Database.com Editions
map the field names in your import file with the field names in Salesforce.
• Command line (Windows only)—When you use the command line, you specify the configuration,
data sources, mappings, and actions in files. This enables you to set up Data Loader for automated processing.
Data Loader offers the following key features:
• An easy-to-use wizard interface for interactive use
• An alternate command-line interface for automated batch operations (Windows only)
• Support for large files with up to 5 million records
• Drag-and-drop field mapping
• Support for all objects, including custom objects
• Can be used to process data in both Salesforce and Database.com
• Detailed success and error log files in CSV format
• A built-in CSV file viewer
• Support for Windows and Mac
To get started, see the following topics:
• When to Use Data Loader
• Considerations for Installing Data Loader
Note: In previous versions, Data Loader has been known as “AppExchange Data Loader“ and “Sforce Data Loader.”
1
CHAPTER 2 When to Use Data Loader
2
CHAPTER 3 Installing Data Loader
In this chapter ... You can use Data Loader to insert, update, delete, and export
EDITIONS
Salesforce records.
• Install Data Loader
Available in: both Salesforce
on macOS
Classic (not available in all
• Install Data Loader orgs) and Lightning
on Windows Experience
• Considerations for
Installing Data Available in: Enterprise,
Loader Performance, Unlimited,
Developer, and
Database.com Editions
3
Installing Data Loader Install Data Loader on macOS
6. Specify whether to add a Data Loader launch icon on your desktop or Applications folder. Data
Loader completes the installation. USER PERMISSIONS
To run Data Loader, use the Data Loader desktop icon, Applications folder, or dataloader.command To access the page to
in your installation folder. If Zulu OpenJDK is not found, a message prompts you to download and download Data Loader:
install it. • Modify All Data
Note: To continue using your settings from an earlier Data Loader version in version 45 and To use Data Loader:
later, migrate your config and log files after installation. Search for config.properties • API Enabled
and log-config.xml, and copy or move the files to your current Data Loader’s AND
/config folder. The appropriate user
permission for the
operation you are doing,
for example, Create on
accounts to insert new
accounts
AND
Bulk API Hard Delete
(only if you configure
Data Loader to use Bulk
API to hard-delete
records)
4
Installing Data Loader Install Data Loader on Windows
6. Specify whether to create a Data Loader launch icon on your desktop or a start menu shortcut.
Data Loader completes the installation. USER PERMISSIONS
To run Data Loader, use the Data Loader desktop icon, start menu entry, or the dataloader.bat file To access the page to
in your installation folder. If Zulu OpenJDK is not found, a message prompts you to download and download Data Loader:
install it. • Modify All Data
Note: To continue using your settings from an earlier Data Loader version in version 45 and To use Data Loader:
later, migrate your config and log files after installation. Search for config.properties • API Enabled
and log-config.xml, and copy or move the files to your current Data Loader’s AND
/config folder. The appropriate user
permission for the
operation you are doing,
for example, Create on
accounts to insert new
accounts
AND
Bulk API Hard Delete
(only if you configure
Data Loader to use Bulk
API to hard-delete
records)
5
Installing Data Loader Considerations for Installing Data Loader
Note: Salesforce no longer bundles Java with the Data Loader for Windows installer. USER PERMISSIONS
Download and install Java on your Windows computer.
To access the page to
We recommend that you set the JAVA_HOME environment variable to the directory where download Data Loader:
Zulu OpenJDK is installed. Doing so ensures that you can run Data Loader in batch mode • Modify All Data
from the command line.
To use Data Loader:
• API Enabled
AND
System Requirements for macOS
The appropriate user
To use Data Loader for macOS, you need: permission for the
• 64-bit macOS El Capitan operation you are doing,
for example, Create on
• 120 MB of free disk space accounts to insert new
• 256 MB of available memory accounts
• Zulu OpenJDK version 11 AND
Bulk API Hard Delete
(only if you configure
Installation Considerations Data Loader to use Bulk
API to hard-delete
Over time, several versions of the Data Loader client application have been available for download. records)
Some earlier versions were called “AppExchange Data Loader” or “Sforce Data Loader.” You can run
different versions at the same time on one computer. However, do not install more than one copy
of the same version. If you have installed the latest version and want to install it again, first remove
the version on your computer.
The latest version is always available in Salesforce. From Setup, enter Data Loader in the Quick Find box, then select Data Loader.
Tip: If you experience login issues in the command-line interface after upgrading Data Loader, try encrypting your password again
to solve the problem. For information, see Encrypt from the Command Line on page 26.
Note: The Data Loader command-line interface is supported for Windows only.
To change the source code, download the open-source version of Data Loader from https://github.com/forcedotcom/dataloader.
6
Installing Data Loader Considerations for Installing Data Loader
Login Considerations
• If your organization restricts IP addresses, logins from untrusted IPs are blocked until they’re activated. Salesforce automatically sends
you an activation email that you can use to log in. The email contains a security token that you must add to the end of your password.
For example, if your password is mypassword, and your security token is XXXXXXXXXX, you must enter
mypasswordXXXXXXXXXX to log in.
• Data Loader version 36.0 and later supports Web Server OAuth Authentication. See OAuth Authentication for more information.
• Data Loader version 36.0 and later supports Salesforce Communities. Communities users always log in with the OAuth option in
Data Loader. To enable OAuth for Communities, the user modifies the config.properties file as follows.
– Change the portion in bold in the following line to the login URL of the community. Don’t add a forward slash (/) to the end of
the line.
sfdc.oauth.Production.server=https\://login.salesforce.com
For example:
sfdc.oauth.Production.server=
https\://johnsmith-developer-edition.yourInstance.force.com/test
– Change the portion in bold in the following line to the hostname of the community.
sfdc.oauth.Production.redirecturi=https\://login.salesforce.com/services/oauth2/success
For example:
sfdc.oauth.Production.redirecturi=
https\:/johnsmith-developer-edition.yourInstance.force.com/services/oauth2/success
The config.properties file is in the configs default configuration directory, which is installed in these locations.
– macOS: /Users/{userName}/dataloader/version/configs
– Windows: C:\Users\{userName}\dataloader\version\configs
7
CHAPTER 4 Configure Data Loader
In this chapter ... Use the Settings menu to change the Data Loader default operation
EDITIONS
settings.
• Data Loader
1. Open the Data Loader. Available in: both Salesforce
Behavior with Bulk
Classic and Lightning
API Enabled 2. Select Settings > Settings.
Experience
• Configure the Data 3. Edit the fields as needed.
Loader to Use the Available in: Enterprise,
Bulk API Performance, Unlimited,
Field Description
Developer, and
Batch size In a single insert, update, Database.com Editions
upsert, or delete operation,
records moving to or from
Salesforce are processed in
increments of this size. The
maximum is 200 records. We
recommend a value between
50 and 100.
The maximum value is 10,000
if the Use Bulk API
option is selected.
8
Configure Data Loader
Field Description
updates, and upserts on cases and leads. It also
applies to updates on accounts if your
organization has territory assignment rules on
accounts. The assignment rule overrides Owner
values in your CSV file.
Server host Enter the URL of the Salesforce server with which
you want to communicate. For example, if you
are loading data into a sandbox, change the URL
to https://test.salesforce.com.
Reset URL on Login By default, Salesforce resets the URL after login
to the one specified in Server host. To turn
off this automatic reset, disable this option.
Generate status files for Select this option to generate success and error
exports files when exporting data.
Read all CSVs with UTF-8 Select this option to force files to open in UTF-8
encoding encoding, even if they were saved in a different
format.
Write all CSVs with UTF-8 Select this option to force files to be written in
encoding UTF-8 encoding.
Use European date format Select this option to support the date formats
dd/MM/yyyy and dd/MM/yyyy
HH:mm:ss.
9
Configure Data Loader
Field Description
into Salesforce: Email, Multi-select Picklist, Phone,
Picklist, Text, and Text (Encrypted).
In Data Loader versions 14.0 and earlier, Data
Loader truncates values for fields of those types
if they are too large. In Data Loader version 15.0
and later, the load operation fails if a value is
specified that is too large.
Selecting this option allows you to specify that
the previous behavior, truncation, be used
instead of the new behavior in Data Loader
versions 15.0 and later. This option is selected
by default and has no effect in versions 14.0 and
earlier.
This option is not available if the Use Bulk
API option is selected. In that case, the load
operation fails for the row if a value is specified
that is too large for the field.
Allow comma as a CSV delimiter Select this option if your CSV file uses commas
to delimit records.
Allow tab as a CSV delimiter Select this option if your CSV file uses tab
characters to delimit records.
Allow other characters as CSV Select this option if your CSV file uses a character
delimiters other than a comma or tab to delimit records.
Other delimiters (enter The characters in this field are used only if the
multiple values with no Allow other characters as CSV delimiters
separator; for example, !+?) option is selected. For example, if you use the |
(pipe) character to delimit data records, enter
that character in this field.
Use Bulk API Select this option to use Bulk API to insert,
update, upsert, delete, and hard-delete records.
Bulk API is optimized to load or delete many
records asynchronously. It’s faster than the
default SOAP-based API due to parallel
processing and fewer network round-trips.
10
Configure Data Loader
Field Description
Enable serial mode for Bulk API To use serial processing instead of parallel
processing for Bulk API, select this option.
Processing in parallel can cause database
contention. When contention is severe, the load
can fail. Serial mode processes batches one at a
time, however it can increase the processing
time for a load.
This option is only available if the Use Bulk
API option is selected.
Upload Bulk API Batch as Zip Select this option to use Bulk API to upload zip
File files containing binary attachments, such as
Attachment records or Salesforce CRM Content.
This option is only available if the Use Bulk
API option is selected.
Proxy NTLM domain The name of the Windows domain used for
NTLM authentication.
Start at row If your last operation failed, you can use this
setting to begin where the last successful
operation finished.
11
Configure Data Loader
12
Configure Data Loader Data Loader Behavior with Bulk API Enabled
Note:
• You can also select the Enable serial mode for Bulk API option.
Processing in parallel can cause database contention. When contention is severe, the
load can fail. Serial mode processes batches one at a time, however it can increase the
processing time for a load.
• Caution: You can hard delete records when you configure Data Loader to Use Bulk
API. Keep in mind that hard deleted records are immediately deleted and can’t be
recovered from the Recycle Bin.
13
CHAPTER 5 Using Data Loader
In this chapter ... Using Data Loader, you can perform various operations which
EDITIONS
include exporting data, defining field mappings, inserting, updating,
• Data Types and deleting data, performing mass updates and mass deletes, Available in: Salesforce
Supported by Data uploading attachments and content, and reviewing output files. Classic (not available in all
Loader
orgs) and Lightning
• Export Data Experience
• Define Data Loader
Field Mappings Available in: Enterprise,
Performance, Unlimited,
• Insert, Update, or
Developer, and
Delete Data Using
Database.com Editions
Data Loader
• Upload Attachments
• Upload Content with
the Data Loader
• Review Data Loader
Output Files
• Data Import Dates
• View the Data Loader
Log File
• Configure the Data
Loader Log File
14
Using Data Loader Data Types Supported by Data Loader
15
Using Data Loader Export Data
• To enable date formats that begin with the day rather than the month, select the Use European date format box in
the Settings dialog. European date formats are dd/MM/yyyy and dd/MM/yyyy HH:mm:ss.
• If your computer's locale is east of Greenwich Mean Time (GMT), we recommend that you change your computer setting to
GMT in order to avoid date adjustments when inserting or updating records.
• Only dates within a certain range are valid. The earliest valid date is 1700-01-01T00:00:00Z GMT, or just after midnight on January
1, 1700. The latest valid date is 4000-12-31T00:00:00Z GMT, or just after midnight on December 31, 4000. These values are offset
by your time zone. For example, in the Pacific time zone, the earliest valid date is 1699-12-31T16:00:00, or 4:00 PM on December
31, 1699.
Double
Standard double string
ID
A Salesforce ID is a case-sensitive 15-character or case–insensitive 18-character alphanumeric string that uniquely identifies a particular
record.
Tip: To ensure data quality, make sure that all Salesforce IDs you enter in Data Loader are in the correct case.
Integer
Standard integer string
String
All valid XML strings; invalid XML characters are removed.
Export Data
You can use the Data Loader export wizard to extract data from a Salesforce object.
EDITIONS
1. Open the Data Loader.
Available in: both Salesforce
2. Click Export. If you want to also export archived activity records and soft-deleted records, click
Classic (not available in all
Export All instead.
orgs) and Lightning
3. Enter your Salesforce username and password, and click Log in. Experience
4. When you’re logged in, click Next. (You are not asked to log in again until you log out or close Available in: Enterprise,
the program.) Performance, Unlimited,
If your organization restricts IP addresses, logins from untrusted IPs are blocked until they’re Developer, and
activated. Salesforce automatically sends you an activation email that you can use to log in. The Database.com Editions
email contains a security token that you must add to the end of your password. For example,
if your password is mypassword, and your security token is XXXXXXXXXX, you must enter USER PERMISSIONS
mypasswordXXXXXXXXXX to log in.
To export records:
5. Choose an object. For example, select the Account object. If your object name isn’t listed, select • Read on the records
Show all objects to see all the objects that you can access. The objects are listed by localized
To export all records:
label name, with the developer name in parentheses. For object descriptions, see the SOAP API
• Read on the records
Developer Guide.
6. Select the CSV file to export the data to. You can choose an existing file or create a file.
If you select an existing file, the export replaces its contents. To confirm the action, click Yes, or choose another file by clicking No.
7. Click Next.
16
Using Data Loader Export Data
8. Create a SOQL query for the data export. For example, select Id and Name in the query fields, and click Finish. As you follow the
next steps, the CSV viewer displays all the Account names and their IDs. SOQL is the Salesforce Object Query Language. Similar to
the SELECT command in SQL, with SOQL, you can specify the source object, a list of fields to retrieve, and conditions for selecting
rows in the source object.
a. Choose the fields you want to export.
b. Optionally, select conditions to filter your dataset. If you do not select any conditions, all the data to which you have read access
is returned.
c. Review the generated query and edit if necessary.
Tip: You can use a SOQL relationship query to include fields from a related object. For example:
Select Name, Pricebook2Id, Pricebook2.Name, Product2Id, Product2.ProductCode FROM
PricebookEntry WHERE IsActive = true
Or:
Select Id, LastName, Account.Name FROM Contact
When using relationship queries in the Data Loader, the fully specified field names are case-sensitive. For example, using
ACCOUNT.NAME instead of Account.Name does not work.
Data Loader doesn’t support nested queries or querying child objects. For example, queries similar to the following return an
error:
SELECT Amount, Id, Name, (SELECT Quantity, ListPrice,
PriceBookEntry.UnitPrice, PricebookEntry.Name,
PricebookEntry.product2.Family FROM OpportunityLineItems)
FROM Opportunity
Also, Data Loader doesn’t support queries that use polymorphic relationships. For example, the following query results in an
error:
SELECT Id, Owner.Name, Owner.Type, Owner.Id, Subject FROM Case
For more information on SOQL, see the SOQL and SOSL Reference.
10. To view the CSV file. click View Extraction, or to close, click OK. For more details, see Review Data Loader Output Files on page 22.
Note:
• Data Loader currently does not support exporting attachments. As a workaround, use the weekly export feature in the online
application to export attachments.
• If you select compound fields for export in the Data Loader, they cause error messages. To export values, use individual field
components.
17
Using Data Loader Define Data Loader Field Mappings
2. To manually match fields with columns, click and drag fields from the list of Salesforce fields at Available in: Enterprise,
the top to the list of CSV column header names at the bottom. For example, if you are inserting Performance, Unlimited,
new Account records where your CSV file contains the names of new accounts, click and drag Developer, and
the Name field to the right of the NAME column header field. Database.com Editions
3. Optionally, click Save Mapping to save this mapping for future use. Specify a name for the
SDL mapping file.
If you select an existing file, the export replaces its contents. To confirm the action, click Yes, or choose another file by clicking No.
Use the Data Loader wizards to add, modify, or delete records. The upsert wizard combines inserting and updating a record. If a record
in your file matches an existing record, the existing record is updated with the values in your file. If no match is found, a new record is
created. When you hard-delete records, the deleted records are not stored in the Recycle Bin and are eligible for deletion. For more
information, see Configure Data Loader.
1. Open the Data Loader.
2. Click Insert, Update, Upsert, Delete, or Hard Delete. These commands are also listed in the File menu.
3. Enter your Salesforce username and password. To log in, click Log in. When you are logged in, click Next. (Until you log out or close
the program, you are not asked to log in again.)
If your organization restricts IP addresses, logins from untrusted IPs are blocked until they’re activated. Salesforce automatically sends
you an activation email that you can use to log in. The email contains a security token that you must add to the end of your password.
For example, if your password is mypassword, and your security token is XXXXXXXXXX, you must enter
mypasswordXXXXXXXXXX to log in.
18
Using Data Loader Insert, Update, or Delete Data Using Data Loader
4. Choose an object. For example, if you are inserting Account records, select Account. If your object name does not display in the
default list, select Show all objects to see a complete list of the objects that you can access. The objects are listed by localized label
name, with the developer name noted in parentheses. For object descriptions, see the Object Reference for Salesforce and Lightning
Platform.
Note: Data Loader deletes records based on the IDs in the CSV file, not the object selected.
5. To select your CSV file, click Browse. For example, if you are inserting Account records, you could specify a CSV file called
insertaccounts.csv containing a Name column for the names of the new accounts.
6. Click Next. After the object and CSV file are initialized, click OK.
7. If you are performing an upsert, your CSV file must contain a column of ID values for matching against existing records. The column
is either an external ID (a custom field with the External ID attribute) or ID (the Salesforce record ID).
a. From the dropdown list, select which field to use for matching. If the object has no external ID fields, ID is used. Click Next to
continue.
b. If your file includes the external IDs of an object that has a relationship to your chosen object, enable that external ID for record
matching by selecting its name from the dropdown list. If you make no selection, you can use the related object’s ID field for
matching by mapping it in the next step. Click Next to continue.
8. Define how the columns in your CSV file map to Salesforce fields. To select an existing field mapping, click Choose an Existing
Map. To create or modify a map, click Create or Edit a Map. For more information, see Define Data Loader Field Mappings on page
18. Click Next.
9. For each operation, the Data Loader generates two unique CSV log files. One file name starts with “success,” and the other starts
with “error.” Click Browse to specify a directory for these files.
10. To complete the operation, click Finish, and then click Yes to confirm. As the operation proceeds, a progress information window
reports the status of the data movement.
11. To view your success or error files, click View Successes or View Errors. To close the wizard, click OK . For more information, see
Review Data Loader Output Files on page 22.
Tip:
• If you are updating or deleting large amounts of data, review Perform Mass Updates and Perform Mass Deletes for tips and
best practices.
• There is a 5-minute limit to process 100 records when the Bulk API is enabled. If it takes longer than 10 minutes to process a
file, the Bulk API places the remainder of the file back in the queue for later processing. If the Bulk API continues to exceed the
10-minute limit on subsequent attempts, the file is placed back in the queue and reprocessed up to 10 times before the
operation is permanently marked as failed. Even if the processing fails, some records could have completed successfully, so
check the results. If you get a timeout error when loading a file, split your file into smaller files and try again.
19
Using Data Loader Perform Mass Updates
6. If you made a mistake, use the backup file to update the records to their previous values.
20
Using Data Loader Upload Content with the Data Loader
Make sure that the values in the Body column contain the full path of the attachments on your computer. For example, if an
attachment named myattachment.jpg is the folder C:\Export, Body must specify
C:\Export\myattachment.jpg. Your CSV file looks like this example:
ParentId,Name,Body
50030000000VDowAAG,attachment1.jpg,C:\Export\attachment1.gif
701300000000iNHAAY,attachment2.doc,C:\Export\files\attachment2.doc
50030000000VDowAAG,attachment1.jpg,C:\Export\attachment word document.doc
The CSV file can also include other optional Attachment fields, such as Description.
2. Proceed with an insert or upsert operation (see Insert, Update, or Delete Data Using Data Loader on page 18). For the select data
objects step, select Show all Salesforce objects and the attachment object name in the list.
Note: If there are commas in the description, use double quotes around the text.
• VersionData - complete file path on your local drive (for uploading documents only).
Note: Files are converted to base64 encoding on upload. This action adds approximately 30% to the file size.
• PathOnClient - complete file path on your local drive (for uploading documents only).
• ContentUrl - URL (for uploading links only).
• OwnerId - (optional) file owner, defaults to the user uploading the file.
• FirstPublishLocationId - library ID.
21
Using Data Loader Review Data Loader Output Files
Note: If you publish to a library that has restricted record types, specify RecordTypeId.
To determine the RecordTypeId values for your organization using Data Loader, follow the steps in Exporting Data. The
following is a sample SOQL query:
Select Id, Name FROM RecordType WHERE SobjectType = 'ContentVersion'
To determine the RecordTypeId values for your organization using the AJAX Toolkit:
a. Log in to Salesforce.
b. Enter this URL in your browser:
http://instanceName.salesforce.com/soap/ajax/45.0/debugshell.html. Enter the
instanceName for your organization. You can see the instanceName in the URL field of your browser after logging
in to Salesforce.
c. In the AJAX Toolkit Shell page, type:
sforce.connection.describeSObject("ContentVersion")
d. Press Enter.
e. Click the arrows for recordTypeInfos.
The RecordTypeId values for your organization are listed.
2. Upload the CSV file for the ContentVersion object (see Insert, Update, or Delete Data Using Data Loader on page 18). All documents
and links are available in the specified library.
22
Using Data Loader Data Import Dates
Note: If the object you are exporting has a column named “success” or “error,” your output file columns could display incorrect
information. To avoid this problem, rename the columns.
5. To return to the CSV Chooser window, click Close. To exit the window, click OK.
Note: To generate success files when exporting data, select Generate status files for exports. For more
information, see Configure Data Loader on page 8.
23
Using Data Loader Configure the Data Loader Log File
24
CHAPTER 6 Running in Batch Mode (Windows Only)
In this chapter ... You can run Data Loader in batch mode from the Windows
EDITIONS
command line. Batch mode runs a series of Data Loader processes
• Installed Directories in a certain order using a batch file. You can rerun the same Available in: Salesforce
and Files sequence of processes using an executable .bat file. Classic (not available in all
• Encrypt from the orgs) and Lightning
Command Line Note: The Data Loader command-line interface is supported
Experience
for Windows only.
• Upgrade Your Batch
Mode Interface Available in: Enterprise,
Note: If you’re batch mode from the command line with a
Performance, Unlimited,
• Run Batch File With version earlier than 8.0, see Upgrade Your Batch Mode
Developer, and
Windows Interface on page 27. Database.com Editions
Command-Line
Interface
• Configure Batch
Processes
• Data Loader Process
Configuration
Parameters
• Data Loader
Command-Line
Operations
• Configure Database
Access
• Map Columns
• Run Individual Batch
Processes
25
Running in Batch Mode (Windows Only) Installed Directories and Files
Note: The Data Loader command-line interface is supported for Windows only. Available in: Salesforce
Classic (not available in all
bin orgs) and Lightning
Contains the batch files encrypt.bat for encrypting passwords and process.bat for Experience
running batch processes. Available in: Enterprise,
For information on running Data Loader from the command-line, see Run Batch File With Performance, Unlimited,
Windows Command-Line Interface on page 27. Developer, and
Database.com Editions
configs
The default configuration directory. Contains the configuration files config.properties,
Loader.class, and log-conf.xml.
The config.properties file that is generated when you modify the Settings dialog in the graphical user interface is located
at C:\Users\{userName}\dataloader\version\configs.
Data Loader runs the operation, file, or map listed in the configuration file that you specify. If you don’t specify a configuration
directory, the current directory is used.
samples
Contains subdirectories of sample files for reference.
Note: The Data Loader command-line interface is supported for Windows only. Available in: Salesforce
Classic (not available in all
When running Data Loader in batch mode from the command line, you must encrypt the following orgs) and Lightning
configuration parameters: Experience
26
Running in Batch Mode (Windows Only) Upgrade Your Batch Mode Interface
Note: The Data Loader command-line interface is supported for Windows only. Available in: Salesforce
Classic (not available in all
Include your encrypted password in the configuration file to run a batch operation. For more orgs) and Lightning
information, see Data Loader Command Line Introduction on page 46 and Encrypt from the Experience
Command Line on page 26. From the command line, navigate to the bin directory, and enter
Available in: Enterprise,
process.bat. This file takes the following parameters. Performance, Unlimited,
• The directory containing config.properties Developer, and
Database.com Editions
• The name of the batch process bean contained in process-conf.xml
You use the process-conf.xml file to configure batch processing. Set the name of the
process in the bean element's id attribute: (for example <bean id="myProcessName">).
27
Running in Batch Mode (Windows Only) Configure Batch Processes
You can change parameters at run time by giving param=value as program arguments. For example, adding
process.operation=insert to the command changes the configuration at run time.
The process.bat file supports running JAR with up to two parameters. The format for two parameters is:
java -cp ..\dataloader-xx.0.0-uber.jar -Dsalesforce.config.dir=<configdir>
com.salesforce.dataloader.process.ProcessRunner <operation> parameterName1=ParemeterValue1
parameterName2=ParemeterValue2
Tip: If you experience login issues in the command-line interface after upgrading Data Loader, try encrypting your password again
to solve the problem. For information, see Encrypt from the Command Line on page 26.
28
Running in Batch Mode (Windows Only) Data Loader Process Configuration Parameters
Write
all
CSVs Select this option to force files to be
with written in UTF-8 encoding.
UTF-8
dataAccess.writeUTF8 boolean encoding Sample value: true
29
Running in Batch Mode (Windows Only) Data Loader Process Configuration Parameters
Allow
comma as
a CSV Select this option if your CSV file uses commas to
loader.csvComma boolean delimiter delimit records.
Allow
tab as a
CSV Select this option if your CSV file uses tab characters
loader.csvTab boolean delimiter to delimit records.
Allow
other
characters
as CSV Select this option if your CSV file uses a character
loader.csvOther boolean delimiters other than a comma or tab to delimit records.
Other
delimiters
(enter
multiple
values
with no The characters in this field are used only if the Allow
separator; other characters as CSV delimiters option is
for selected. For example, if you use the | (pipe) character
example, to delimit data records, enter that character in this
loader.csvOtherValue string !+?) field.
Generate
status Select this option to generate success and error files
files when exporting data.
for
process.enableExtractStatusOutput boolean exports Sample value: true
30
Running in Batch Mode (Windows Only) Data Loader Process Configuration Parameters
31
Running in Batch Mode (Windows Only) Data Loader Process Configuration Parameters
The name of the CSV file that stores error data from
the last operation.
The name of the CSV file that stores success data from
the last operation. See also
process.enableExtractStatusOutput
on page 30.
32
Running in Batch Mode (Windows Only) Data Loader Process Configuration Parameters
See
process.enableExtractStatusOutput
on page 30. Stores SOAP messages sent to or from
Salesforce. As messages are sent or received, they are
appended to the end of the file. As the file does not
have a size limit, monitor your available disk storage
appropriately.
33
Running in Batch Mode (Windows Only) Data Loader Process Configuration Parameters
34
Running in Batch Mode (Windows Only) Data Loader Process Configuration Parameters
35
Running in Batch Mode (Windows Only) Data Loader Process Configuration Parameters
36
Running in Batch Mode (Windows Only) Data Loader Command-Line Operations
extract all Uses SOQL to export a set of records from Salesforce, including
existing and soft-deleted records. The exported data is written to
a data source.
insert Loads data from a data source into Salesforce as new records.
update Loads data from a data source into Salesforce, and updates
existing records with matching ID fields.
37
Running in Batch Mode (Windows Only) Configure Database Access
Operation Description
upsert Loads data from a data source into Salesforce. Existing records with a matching custom
external ID field are updated. Records without matches are inserted as new records.
delete Loads data from a data source into Salesforce, and deletes existing records with matching
ID fields. Deleted records are moved to the Recycle Bin.
hard delete Loads data from a data source into Salesforce, and deletes existing records with matching
ID fields without first storing them in the Recycle Bin.
DataSource
The DataSource bean sets the physical information needed for database connections. It contains the following properties:
driverClassName
The fully qualified name of the implementation of a JDBC driver.
url
The string for physically connecting to the database.
username
The username for logging in to the database.
38
Running in Batch Mode (Windows Only) Spring Framework
password
The password for logging in to the database.
Depending on your implementation, additional information may be required. For example, use
org.apache.commons.dbcp.BasicDataSource when database connections are pooled.
The following code is an example of a DataSource bean:
<bean id="oracleRepDataSource"
class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
<property name="url" value="jdbc:oracle:thin:@myserver.salesforce.com:1521:TEST"/>
<property name="username" value="test"/>
<property name="password" value="test"/>
</bean>
Versions of Data Loader from API version 25.0 onwards do not come with an Oracle JDBC driver. Using Data Loader to connect to an
Oracle data source without a JDBC driver installed will result in a “Cannot load JDBC driver class” error. To add the Oracle JDBC driver to
Data Loader:
• Download the latest JDBC driver from
http://www.oracle.com/technetwork/database/features/jdbc/index-091264.html.
• Copy the JDBC .jar file to data loader install folder/java/bin.
Spring Framework
Note: The Data Loader command-line interface is supported for Windows only. EDITIONS
The Data Loader configuration files are based on the Spring Framework, which is an open-source, Available in: Salesforce
full-stack Java/J2EE application framework. Classic (not available in all
The Spring Framework allows you to use XML files to configure beans. Each bean represents an orgs) and Lightning
instance of an object; the parameters correspond to each object's setter methods. A typical bean Experience
has the following attributes:
Available in: Enterprise,
id Performance, Unlimited,
Uniquely identifies the bean to XmlBeanFactory, which is the class that gets objects from Developer, and
an XML configuration file. Database.com Editions
class
Specifies the implementation class for the bean instance.
For more information on the Spring Framework, see the official documentation and the support forums. Note that Salesforce cannot
guarantee the availability or accuracy of external websites.
39
Running in Batch Mode (Windows Only) Data Access Objects
SQL Configuration
Note: The Data Loader command-line interface is supported for Windows only. EDITIONS
When running Data Loader in batch mode from the command line, the SqlConfig class contains Available in: Salesforce
configuration parameters for accessing specific data in the database. As shown in the code samples Classic (not available in all
below, queries and inserts are different but very similar. The bean must be of type orgs) and Lightning
com.salesforce.dataloader.dao.database.SqlConfig and have the following Experience
properties:
Available in: Enterprise,
sqlString Performance, Unlimited,
The SQL code to be used by the data access object. Developer, and
The SQL can contain replacement parameters that make the string dependent on configuration Database.com Editions
or operation variables. Replacement parameters must be delimited on both sides by “@”
characters. For example, @process.lastRunDate@.
sqlParams
A property of type map that contains descriptions of the replacement parameters specified in sqlString. Each entry represents
one replacement parameter: the key is the replacement parameter's name, the value is the fully qualified Java type to be used when
the parameter is set on the SQL statement. Note that “java.sql” types are sometimes required, such as java.sql.Date instead
of java.util.Date. For more information, see the official JDBC API documentation.
columnNames
Used when queries (SELECT statements) return a JDBC ResultSet. Contains column names for the data outputted by executing
the SQL. The column names are used to access and return the output to the caller of the DataReader interface.
40
Running in Batch Mode (Windows Only) SQL Configuration
singleton="true">
<property name="sqlString"/>
<value>
SELECT distinct
'012x00000000Ij7' recordTypeId,
accounts.account_number,
org.organization_name,
concat (concat(parties.address1, ' '), parties.address2) billing_address,
locs.city,
locs.postal_code,
locs.state,
locs.country,
parties.sic_code
from
ar.hz_cust_accounts accounts,
ar.hz_organization_profiles org,
ar.hz_parties parties,
ar.hz_party_sites party_sites,
ar.hz_locations locs
where
accounts.PARTY_ID = org.PARTY_ID
and parties.PARTY_ID = accounts.PARTY_ID
and party_sites.PARTY_ID = accounts.PARTY_ID
and locs.LOCATION_ID = party_sites.LOCATION_ID
and (locs.last_update_date > @process.lastRunDate@ OR
accounts.last_update_date > @process.lastRunDate@
</value>
</property>
<property name="columNames">
<list>
<value>recordTypeId</value>
<value>account_number</value>
<value>organization_name</value>
<value>billing_address</value>
<value>city</value>
<value>postal_code</value>
<value>state</value>
<value>country</value>
<value>sic_code</value>
</list>
</property>
<property name="sqlParams">
<map>
<entry key="process.lastRunDate" value="java.sql.Date"/>
</map>
</property>
</bean>
41
Running in Batch Mode (Windows Only) Map Columns
singleton="true">
<property name="sqlString"/>
<value>
INSERT INTO REP.INT_PARTIES (
BILLING_ADDRESS, SIC_CODE)
VALUES (@billing_address@, @sic_code@)
</value>
</property>
<property name="sqlParams"/>
<map>
<entry key="billing_address" value="java.lang.String"/>
<entry key="sic_code" value="java.lang.String"/>
</map>
</property>
</bean>
Map Columns
Note: The Data Loader command-line interface is supported for Windows only. EDITIONS
When running Data Loader in batch mode from the command line, you must create a properties Available in: Salesforce
file that maps values between Salesforce and data access objects. Classic (not available in all
1. Create a new mapping file and give it an extension of .sdl. orgs) and Lightning
Experience
2. Observe the following syntax:
• On each line, pair a data source with its destination. Available in: Enterprise,
Performance, Unlimited,
• In an import file, put the data source on the left, an equals sign (=) as a separator, and the Developer, and
destination on the right. In an export file, put the destination on the left, an equals sign (=) Database.com Editions
as a separator, and the data source on the right.
• Data sources can be either column names or constants. Surround constants with double
quotation marks, as in “sampleconstant”. Values without quotation marks are treated as column names.
• Destinations must be column names.
• You may map constants by surrounding them with double quotation marks, as in:
"Canada"=BillingCountry
3. In your configuration file, use the parameter process.mappingFile to specify the name of your mapping file.
Note: If your field name contains a space, you must escape the space by prepending it with a backslash (\). For example:
Account\ Name=Name
42
Running in Batch Mode (Windows Only) Map Columns
OWNERID=OwnerId
CUSTOMERPRIORITY__C=CustomerPriority__c
ANNUALREVENUE=AnnualRevenue
DESCRIPTION=Description
BILLINGSTREET=BillingStreet
SHIPPINGSTATE=ShippingState
Note: If you specify a constant value that contains spaces, you must escape the spaces by prepending each with a backslash (\).
For example:
"Food\ &\ Beverage"=Industry
43
Running in Batch Mode (Windows Only) Run Individual Batch Processes
Process Example
process ../conf accountMasterProcess
Note: To view tips and instructions, add -help to the command contained in process.bat.
Note: You can configure external process launchers, such as the Windows XP Scheduled Task Wizard, to run processes on a
schedule.
44
CHAPTER 7 Command-Line Quick Start (Windows Only)
In this chapter ... Note: The Data Loader command-line interface is supported EDITIONS
for Windows only.
• Data Loader
This quick start shows you how to use the Data Loader Available in: Salesforce
Command Line
command-line functionality to import data. Classic (not available in all
Introduction
orgs) and Lightning
• Prerequisites Experience
• Step One: Create the
Encryption Key File Available in: Enterprise,
Performance, Unlimited,
• Step Two: Create the
Developer, and
Encrypted Password
Database.com Editions
• Step Three: Create
the Field Mapping
File
• Step Four: Create the
Configuration File
• Step Five: Import the
Data
45
Command-Line Quick Start (Windows Only) Data Loader Command Line Introduction
SEE ALSO:
Prerequisites
Prerequisites
Note: The Data Loader command-line interface is supported for Windows only. EDITIONS
To step through this quick start requires the following: Available in: Salesforce
• Data Loader installed on the computer that runs the command-line process. Classic (not available in all
• The Java Runtime Environment (JRE) installed on the computer that runs the command-line orgs) and Lightning
process. Experience
• Familiarity with importing and exporting data by using the Data Loader interactively through Available in: Enterprise,
the user interface. This makes it easier to understand how the command-line functionality Performance, Unlimited,
works. Developer, and
Database.com Editions
Tip: When you install Data Loader, sample files are installed in the samples directory
under the user’s directory, for example,
C:\Users\{userName}\dataloader\version\samples\. Examples of files
that are used in this quick start are in the \samples\conf directory.
SEE ALSO:
Data Loader Command Line Introduction
Step One: Create the Encryption Key File
46
Command-Line Quick Start (Windows Only) Step One: Create the Encryption Key File
4. Create an encryption key file by entering the following command. Replace [path to key file] with the key file path.
encrypt.bat —k [path to key file]
Note: To see a list of command-line options for encrypt.bat, enter encrypt.bat on the command line.
5. Note the key file path. In this example, the path is C:\Users\IEUser\.dataloader\dataLoader.key.
The encryption utility encrypts passwords but not data. HTTPS with TLS 1.0 or later encrypts data transmitted by the Apex Data Loader.
SEE ALSO:
Data Loader Command Line Introduction
Step Two: Create the Encrypted Password
47
Command-Line Quick Start (Windows Only) Step Two: Create the Encrypted Password
2. Copy the generated encrypted password. You use this value in a later step.
SEE ALSO:
Data Loader Command Line Introduction
Step Three: Create the Field Mapping File
#Mapping values
#Thu May 26 16:19:33 GMT 2011
Name=Name
NumberOfEmployees=NumberOfEmployees
Industry=Industry
48
Command-Line Quick Start (Windows Only) Step Four: Create the Configuration File
Tip: For complex mappings, you can use the Data Loader user interface to map source and destination fields and then save
those mappings to an .sdl file. This is done on the Mapping dialog box by clicking Save Mapping.
SEE ALSO:
Data Loader Command Line Introduction
Step Four: Create the Configuration File
49
Command-Line Quick Start (Windows Only) Step Four: Create the Configuration File
<entry key="process.mappingFile"
value="C:\DLTest\Command Line\Config\accountInsertMap.sdl"/>
<entry key="dataAccess.name"
value="C:\DLTest\In\insertAccounts.csv"/>
<entry key="process.outputSuccess"
value="c:\DLTest\Log\accountInsert_success.csv"/>
<entry key="process.outputError"
value="c:\DLTest\Log\accountInsert_error.csv"/>
<entry key="dataAccess.type" value="csvRead"/>
<entry key="process.initialLastRunDate"
value="2005-12-01T00:00:00.000-0800"/>
</map>
</property>
</bean>
</beans>
3. Modify the following parameters in the process-conf.xml file. For more information about the process configuration
parameters, see Data Loader Process Configuration Parameters on page 29.
• sfdc.endpoint—Enter the URL of the Salesforce instance for your organization; for example,
https://yourInstance.salesforce.com/.
• sfdc.username—Enter the username Data Loader uses to log in.
• sfdc.password—Enter the encrypted password value that you created in step 2.
• process.mappingFile—Enter the path and file name of the mapping file.
• dataAccess.Name—Enter the path and file name of the data file that contains the accounts that you want to import.
• sfdc.debugMessages—Currently set to true for troubleshooting. Set to false after your import is up and running.
• sfdc.debugMessagesFile—Enter the path and file name of the command line log file.
• process.outputSuccess—Enter the path and file name of the success log file.
• process.outputError—Enter the path and file name of the error log file.
Warning: Use caution when using different XML editors to edit the process-conf.xml file. Some editors add XML
tags to the beginning and end of the file, which causes the import to fail.
SEE ALSO:
Data Loader Command Line Introduction
Step Five: Import the Data
50
Command-Line Quick Start (Windows Only) Step Five: Import the Data
Note: The Data Loader command-line interface is supported for Windows only.
Now that all the pieces are in place, you can run Data Loader from the command line and insert some new accounts.
1. Copy the following data to a file name accountInsert.csv. This is the account data that you import into your organization.
Name,Industry,NumberOfEmployees
Dickenson plc,Consulting,120
GenePoint,Biotechnology,265
Express Logistics and Transport,Transportation,12300
Grand Hotels & Resorts Ltd,Hospitality,5600
SEE ALSO:
Data Loader Command Line Introduction
51
APPENDIX A Data Loader Third-Party Licenses
The following third-party licenses are included with the installation of Data Loader:
EDITIONS
Technology Version License Available in: both Salesforce
Number Classic (not available in all
Apache Jakarta Commons 1.7 http://www.apache.org/licenses/LICENSE-2.0 orgs) and Lightning
BeanUtils Experience
Note: Salesforce is not responsible for the availability or content of third-party websites.
52
INDEX
D L
Data Limits
import limits 23 data import 23
Data Loader
date formats 15
53