Skip to main content

SF-0221 · Scenario · Easy

What are the steps to Delete the data from salesforce using the Data loader?

✓ Verified by Vikas Singhal · Last reviewed 5/17/2026 · Updated for Spring '26

A Delete in Data Loader removes records — soft-deleting them to the recycle bin, where they sit for up to 15 days before Salesforce auto-purges them. (If you want to skip the recycle bin entirely, that’s Hard Delete, a separate operation.)

Step-by-step

  1. Prepare the CSV. You only need one column: Id. Every row is a record to delete. Extra columns are ignored.
  2. Launch Data Loader and click Delete.
  3. Log in to production or sandbox.
  4. Pick the Salesforce object — must match the object the Ids belong to.
  5. Select the CSV file with the Ids to delete.
  6. Map the Id column. Auto-match works if the header is literally Id.
  7. Pick the success / error output directory.
  8. Click Finish. Data Loader streams the rows through the API in batches.
  9. Review success.csv — every Id that was deleted. Review error.csv for failures.

Where do the deleted records go?

To the Recycle Bin. Users with the Recycle Bin tab can undelete them, or you can run an Export All to retrieve them via SOQL. The records age out automatically after 15 days, or sooner if the bin hits its size limit (~5,000 records per licence).

Hard Delete

If you tick Hard Delete instead of plain Delete, records bypass the recycle bin and are gone immediately. This is a permission-protected operation — see How to enable the Hard Delete option on Salesforce Data Loader? for the steps.

Where the Ids usually come from

The standard pattern is Export → filter → Delete:

  1. Run an Export with a SOQL WHERE clause that returns the Ids you want gone.
  2. Save the CSV.
  3. Run Delete against that CSV.

For instance, deleting test data older than 90 days might start with:

SELECT Id FROM Lead WHERE CreatedDate < LAST_N_DAYS:90 AND Test_Lead__c = true

Things that will bite you

  • Cascade deletes. Deleting a parent record (e.g. Account) deletes its master-detail children automatically. The children won’t show up in your Data Loader success file, but they’re gone.
  • Locked records. Records in approval, locked by validation, or referenced as required by other records will fail with messages like ENTITY_IS_LOCKED or DELETE_FAILED.
  • Trigger code. before delete and after delete triggers still fire — they can veto your deletion via addError.
  • Audit history. Deleted records lose all their detail history when the recycle bin purges them. If you need an audit trail, Export All before the delete.

Common failures

ErrorCause
ENTITY_IS_DELETEDRow was already deleted (idempotent, usually fine)
INSUFFICIENT_ACCESS_OR_READONLYUser lacks Delete permission on that record / object
CANNOT_DELETE_RECORDS_HAVE_RELATED_DETAIL_DATARecord has detail records preventing deletion

Verified against: Data Loader Guide — Deleting Data, Metadata API Developer Guide. Last reviewed 2026-05-17 for Spring ‘26 release.