---
schema_version: "1"
id: 4167426b671daac39818a78a271c07a3033999b503803553c98f22cff5cab592
title: Working with Attachments
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/dataloader/dataloader-help/guides/attachments.md
canonical_url: https://developer.salesforce.com/docs/platform/dataloader/guide/attachments.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 8b72d5ccbe34d249bff1a975ab698e2647cd4e8657fcce78e1a58e0d520ca0a1
products:
  - Dataloader from MuleSoft
---
# Working with Attachments

In Salesforce, you link attachment files to specific records, such as contacts, events, or accounts. Import, export, and delete attachments in Dataloader from MuleSoft the same way you work with any other Salesforce object, with a few extra steps to handle the file content.

When you import attachments, map three required fields: **File Name**, **Parent ID**, and **Body**. The **Parent ID** connects each attachment to an existing Salesforce record, and **Body** points to the file inside a ZIP archive.

**important:** Each attachment supports up to 25 MB. The Salesforce Knowledge and Documents tab limits files to 5 MB. The maximum email attachment size is 10 MB.

Because of platform limits, you can process up to 2,000 attachments per run. Larger batches can hit the two-hour task timeout and expire.

## Import an Attachment

To import attachments with Dataloader from MuleSoft, follow these steps.

1. Compress all attachments into a ZIP file that contains all files to upload.

2. Get the IDs of related Salesforce records. Each attachment must be linked to a Salesforce record (for example, a contact or an event) that already exists before you can import it. To get the record IDs, run an [Export Data Task](https://developer.salesforce.com/docs/platform/dataloader/guide/export-data.md) and include the **ID** field.

3. Build a CSV file with the required fields. Your CSV file requires three fields:

   - **File Name**: The file name as you want it to appear in Salesforce.
   - **Parent ID**: The ID of the Salesforce record you link each attachment to.
   - **Body**: The file path of the file as it exists inside the ZIP file from step 1.

   When opened as a spreadsheet, your CSV file should resemble this table:

   | File Name              | Parent ID | Body            |
   | ---------------------- | --------- | --------------- |
   | Attachment1newName.png | 00000001  | Attachment1.png |
   | Attachment2newName.png | 00000002  | Attachment2.png |

   **note:** Use the same column headers in your CSV file as in this example so the required fields map correctly in the import task.

4. Click **New Task** then click **Import**.

   ![New Task menu with Import selected.](https://developer.salesforce.com/docs/media/attachments-download-button.png '{"class": "image-framed image-sm"}')

5. Configure connection, operation, and object:

   1. In the **Connection** dropdown, select the Salesforce connection you want to use.

   2. For the **Operation** type, click [**Insert**](https://developer.salesforce.com/docs/platform/dataloader/guide/import-data.md#insert-data), [**Upsert**](https://developer.salesforce.com/docs/platform/dataloader/guide/import-data.md#upsert-data), or [**Update**](https://developer.salesforce.com/docs/platform/dataloader/guide/import-data.md#update-data).

   3. For **Object**, select **Attachment**.

      ![Import task with Attachment object selected in the object list.](https://developer.salesforce.com/docs/media/attachments-step-2.png '{"class": "image-framed image-md"}')

6. Select the CSV and ZIP files you created. Upload two files: a ZIP file with the attachments and a CSV file that references each attachment. You can select these files from your disk or from cloud storage, such as Dropbox, Box, or FTP/SFTP servers.

7. [Map the fields](https://developer.salesforce.com/docs/platform/dataloader/guide/import-data.md#step-3-map-the-fields), then click **Save** or **Save and Run** ([Save and Run Your Task](https://developer.salesforce.com/docs/platform/dataloader/guide/import-data.md#step-4-save-and-run-your-task)).

## Export an Attachment

Export attachments from Salesforce the same way you export any other object, with the addition of the **Body** field to retrieve the attachment files.

### Select the Attachment Object

Follow the standard export steps in [Export Data from Salesforce](https://developer.salesforce.com/docs/platform/dataloader/guide/export-data.md) and select the **Attachment** object in the first step.

### Include the Body Field and Download Files

Select the **Body** field in the second step. All other fields are metadata about the attachment. The **Body** field contains the attachment file itself.

![Export field list with Body and other attachment fields selected.](https://developer.salesforce.com/docs/media/attachments-step-4.png '{"class": "image-framed image-md"}')

After the task runs, open Task Manager and click the link for the export task to download all attachments as a compressed ZIP file.

## Delete an Attachment

Delete attachments from Salesforce by running a delete task with a CSV file that contains the attachment IDs.

### Prepare a CSV File with Attachment IDs

Delete attachments using the same flow as [any other object](https://developer.salesforce.com/docs/platform/dataloader/guide/delete-data.md). Upload a CSV file with the IDs of the attachments to delete.

### Run a Delete Task for Attachment Records

In the delete task flow, select **Attachment** as the object, upload your CSV file, and run the task.

## See Also

- [Importing Data into Salesforce](https://developer.salesforce.com/docs/platform/dataloader/guide/import-data.md)
- [Export Data from Salesforce](https://developer.salesforce.com/docs/platform/dataloader/guide/export-data.md)
- [Delete Data in Salesforce](https://developer.salesforce.com/docs/platform/dataloader/guide/delete-data.md)
