Bulk update records to an org from a CSV file. Uses Bulk API 2.0.
Description for data update bulk
You can use this command to update millions of Salesforce object records based on 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. The first column of every line in the CSV file must be an ID of the record you want to update. The CSV file can contain only existing records; if a record in the file doesn't currently exist in the Salesforce object, the command fails. Consider using "sf data upsert bulk" if you also want to insert new records.
Bulk updates 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 update 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).
Flags
| Flag Name (Long) | Flag Name (Short) | Description |
|---|---|---|
| <code>‑‑api‑version</code> | N/A | Type: Value<br><br>Override the api version used for api requests made by this command |
| <code>‑‑column‑delimiter</code> | N/A | Type: Value<br>Valid Values: BACKQUOTE, CARET, COMMA, PIPE, SEMICOLON, TAB<br><br>Column delimiter used in the CSV file. |
| <code>‑‑file</code> | <code>‑f</code> | Type: Value<br>Required<br><br>CSV file that contains the Salesforce object records you want to update. |
| <code>‑‑flags‑dir</code> | N/A | Type: Value<br><br>Import flag values from a directory. |
| <code>‑‑json</code> | N/A | Type: Boolean<br><br>Format output as json. |
| <code>‑‑line‑ending</code> | N/A | Type: Value<br>Valid Values: CRLF, LF<br><br>Line ending used in the CSV file. Default value on Windows is CRLF; on macOS and Linux it's LF. |
| <code>‑‑sobject</code> | <code>‑s</code> | Type: Value<br>Required<br><br>API name of the Salesforce object, either standard or custom, which you are updating. |
| <code>‑‑target‑org</code> | <code>‑o</code> | Type: Value<br>Required<br><br>Username or alias of the target org. Not required if the target-org configuration variable is already set. |
| <code>‑‑wait</code> | <code>‑w</code> | Type: Value<br><br>Time to wait for the command to finish, in minutes. |
Examples for data update bulk
Update Account records from a CSV-formatted file into an org with alias "my-scratch"; if the update doesn't complete in 10 minutes, the command ends and displays a job ID:
sf data update bulk --file accounts.csv --sobject Account --wait 10 --target-org my-scratch
<!-- prettier-ignore-end -->