Loading

Export Salesforce Leads With or Without Tags Using Data Loader

Veröffentlichungsdatum: Apr 30, 2026
Beschreibung

Use Data Loader to export Leads with or without assigned personal / public tags to a CSV file.

Lösung

Exporting Lead with or without Tags

Available in the following editions:

  • Enterprise
  • Performance
  • Unlimited
  • Developer
  • Database.com


User permissions

To export records: “Read” on the records
To export all records: “Read” on the records

 

Steps to Resolve

Because Lead Tags are stored as a separate object (LeadTag) from the Lead record itself, exporting leads with their associated tags requires two separate Data Loader exports that are then joined using Excel's VLOOKUP function.

You can use the Apex Data Loader export wizard to export Leads with or without Tags from Salesforce. When you export, you can choose to include (Export All) or exclude (Export) soft-deleted records.

Note: To learn more about Tags, please review the Enable Tags documentation.


1. Open the Data Loader.

2. Select Export or Export All

3. Enter your Salesforce username and password. Click Log in. After your login completes successfully, click Next.

4. Check the box next to Show all Salesforce objects and choose the Lead Tag (LeadTag) object. 

5. Click Browse... to select the CSV file to which the data will be exported. 

6. Click Next.

7. Create a SOQL query for the data export. For example, check Id and Name in the query fields and click Finish.

a. Choose the fields you want to export.
b. Optionally, select conditions to filter your data set. For example, if you want to export all records under this tag name that exist, then you can pull out the Tag Id against that Tag and create a filter as shown in the Screenshot below. Note: If you do not select any conditions, all the data to which you have read access is returned.
c. Review the generated query and edit if necessary.

8. Click Finish, then click Yes to confirm.

9. A progress information window reports the status of the operation.

10. After the operation completes, a confirmation window summarizes your results. Click View Extraction to view the CSV file, or click OK to close.


After you finish exporting LeadTags, you need to use Data Loader to export All Leads by following Steps 4 to 8 once again for the Lead object and save the file with a different name.

We then require opening the LeadTags.csv and AllLeads.csv file. Use the Vlookup function in Microsoft Excel to insert the tag name and tag id into the AllLeads.csv file.

Note: Salesforce does not provide support for Microsoft Excel features or functionality and it's against its policy to perform data management or manipulation (de-duping, merging, cleansing) tasks including vlookups. The following details are provided to serve as general guidelines for customers to prepare their data and can't be performed by Support on their behalf.

Insert a new column in the “AllLeads.csv” file.

Apply vlookup formula in AllLeads.csv new column to find leads id in LeadTags.csv file item id column and pull out the tag name /tag id against it. See below:
=VLOOKUP("002Q8000004d10K", A2:B16, 2, FALSE)
1st - The first argument is the name of the item you're searching for
2nd - The second argument is the cell range that contains the data in another sheet.

Note: It's important to know that VLOOKUP will always search the first column in this range.
3rd - The third argument is the column index number to pull from the table and returned by the formula. The first column in the range is 1; the second column is 2, etc.
4th - The fourth argument tells VLOOKUP whether to look for approximate matches, and it can be either TRUE or FALSE.
Your file is complete now with All leads with & without tags. Use an excel filter to identify.

Repeat the above steps of Vlookup to insert the tag id column in the All Leads.csv file. When done, you can use a filter on tagname/ tagid fields to identify only those records of leads which are tagged and cut them and paste them in a separate file. In that way, you have two files of Lead records with and without tags.

    Nummer des Knowledge-Artikels

    000386894

     
    Laden
    Salesforce Help | Article