Loading

Mass delete attachments with Salesforce Data Loader

Date de publication: Sep 24, 2026
Description

Note: Best practices dictate that you should perform a complete Data Export preceding any mass delete functions in your production Salesforce.com organization.

Résolution

This article explains how to mass delete attachments for an object using Salesforce Data Loader.

Export the Attachments to Delete

  1. Perform a Data Export for the Attachment object that you wish to delete:

    In Salesforce Classic: Setup | Data Management | Data Export
    In Lightning Experience: Setup | Data | Data Export

    Note: Make certain you select the Include attachments/documents checkbox (including attachments/documents may significantly slow down and enlarge your export).

Prepare the Delete File

  1. Take the original Data Export file called "Attachment.csv."
  2. Remove all rows/attachments that you do not want to delete.
  3. Remove all columns except Id.
  4. Save the modified CSV as delete_attachment.csv.

Run the Delete in Data Loader

  1. Log in to Data Loader.
  2. Select the Delete option.
  3. In Step 2, select the Show all Salesforce Objects checkbox; select Attachments; then click the Browse button, select delete_attachment.csv, and click Next.
  4. In Step 3, click Create or Edit a Map and then Auto-Match Fields to Columns. This matches the column header (Id) to your database. Click OK to proceed. Back on the Step 3 Mapping window, click Next. For more, see Define Data Loader Field Mappings.
  5. Specify the directory in Step 4 that will house your Data Loader Success and Error files. This can be any folder on your computer. After specifying the directory, click Finish.
  6. You'll be prompted with a "Yes or No" pop-up to confirm the Delete action. Click Yes. Data Loader will then attempt to delete your Attachments on each of the row records. This process can take a while depending on the size and number of attachments. You'll see an Operation Finished pop-up when the process completes.
Numéro d’article de la base de connaissances

000385197

 
Chargement
Salesforce Help | Article