data import bulk
Bulk import records into a Salesforce object from a CSV file. Uses Bulk API 2.0.
You can use this command to import millions of records into the object from a file in comma-separated values (CSV) format.
All the records in the CSV file must be for the same Salesforce object. Specify the object with the --sobject flag.
Bulk imports can take a while, depending on how many records are in the CSV file. If the command times out, the command displays the job ID. To see the status and get the results of the job, run “sf data import resume” and pass the job ID to the –job-id flag.
For information and examples about how to prepare your CSV files, see “Prepare Data to Ingest” in the “Bulk API 2.0 and Bulk API Developer Guide” (https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/datafiles_prepare_data.htm).
| Flag Name (Long) | Flag Name (Short) | Description |
|---|---|---|
‑‑api‑version | N/A | Type: Value Override the api version used for api requests made by this command |
‑‑column‑delimiter | N/A | Type: Value Valid Values: BACKQUOTE, CARET, COMMA, PIPE, SEMICOLON, TABColumn delimiter used in the CSV file. |
‑‑file | ‑f | Type: Value Required CSV file that contains the Salesforce object records you want to import. |
‑‑flags‑dir | N/A | Type: Value Import flag values from a directory. |
‑‑json | N/A | Type: Boolean Format output as json. |
‑‑line‑ending | N/A | Type: Value Valid Values: CRLF, LFLine ending used in the CSV file. Default value on Windows is CRLF; on macOS and Linux it’s LF. |
‑‑sobject | ‑s | Type: Value Required API name of the Salesforce object, either standard or custom, into which you’re importing records. |
‑‑target‑org | ‑o | Type: Value Required Username or alias of the target org. Not required if the target-org configuration variable is already set. |
‑‑wait | ‑w | Type: Value Time to wait for the command to finish, in minutes. |
Import Account records from a CSV-formatted file into an org with alias “my-scratch”; if the import doesn’t complete in 10 minutes, the command ends and displays a job ID: