How to Merge Salesforce Duplicate Leads Without Losing Data

By Andrew Apell, creator of Flookup Data Wrangler. Updated

About the author

Andrew Apell is the creator of Flookup Data Wrangler and has built data cleaning tools for Google Sheets since 2018. The method in this post pulls through the Salesforce connector into a staging sheet, cleans it there and hands the reviewed groups back to Salesforce.
Every step described here is covered in the documentation linked below.
Read Our Story for the background, or contact the team with any questions about this post, including corrections, unclear steps or use cases we have not covered yet.

Key Takeaways

  • Pull Salesforce leads and contacts with a read only SELECT and clean the copy in Google Sheets.
  • Standardise names first so fuzzy matching groups variants that exact rules miss.
  • Review every duplicate group before a single record is merged in the org.
  • The connector is read only, so a cleaning run cannot change production data.

This method runs entirely in Google Sheets, so there is nothing to download. Open Extensions > Flookup Data Wrangler > Data Connectors, pull the object into the staging sheet and work through the steps below in order.

Only a review sheet is needed for the shorter path, where the pull and the clean are the whole job. The Salesforce connector for Google Sheets walkthrough covers that setup in full.

Why native rules miss fuzzy duplicates

Salesforce matching rules catch exact and near exact pairs at creation time. They miss the pairs that accumulate through imports, web forms and integrations, where Acme Corp and Acme Corporation enter as separate records with separate activity.
Those pairs then distort ownership, reporting and outreach, because each copy holds part of the history.

A Sheets pass solves a different part of the problem. It reads a working copy out of the org, standardises and matches it with phonetic and fuzzy measures and hands you the groups to merge, while the org stays the system of record throughout. The general export pattern is the same one in the CRM data cleaning workflow, with the difference that the connector pulls the records into a staging sheet instead of passing CSV files around.


What you need before you pull

Step Action Why It Matters
1 Connect the Salesforce source through a Connected App Sign-in runs through OAuth in your own browser, and the tokens are stored in the user properties of your Google account
2 Pull leads or contacts with a read only SELECT Anything that is not a SELECT is refused, so a mistyped query cannot modify the org
3 Standardise names, addresses and phones in the staging sheet Consistent values group true duplicates before matching runs
4 Fuzzy match at 0.85 and review the borderline band Reviewed pairs keep precision high on account names and person names
5 Merge the reviewed groups in Salesforce from the list The connector is read only, so the org changes only where you decide

Try the flow against a sandbox org first. Choose Sandbox in the Salesforce card before connecting and create a separate Connected App in the sandbox org with the same callback URL, and the query, the match threshold and the staging sheet can all be proved before production data is involved. The Connected App needs the api and refresh token scopes, and the consumer key and secret go into the connector card in the sidebar.
Tokens are stored in the Apps Script user properties of the Google account that set them up, are never returned to the sidebar, and are removed by Clear on the connector card.


Pull with a read only SOQL query

Enter a SOQL query against the object, for example SELECT Id, Name, Email FROM Contact. The sidebar assembles the statement from the object and field picker and shows it before the pull, the LIMIT is clamped to 5,000 records and results are paged through nextRecordsUrl, so a query returns more than the first batch. Click Pull to staging and the connector clears the staging sheet, writes the field names as a bold header row and then the records.

Keep the Id in the query. It is the column the merge list is read from, and it is what ties a staged row back to the record it came from. The staging sheet is hidden from casual view but is an ordinary sheet, so rename it or copy it to a new tab whenever a review has to survive the next pull. The full control list is in Salesforce connector documentation.


Standardise and match in the staging sheet

Standardise first. Company suffixes, punctuation and case otherwise split groups that belong together, and matching on raw values misses them. Then match on the standardised form with exact, normalised, phonetic and fuzzy measures across one column or a whole table. The threshold advice in fuzzy matching in Google Sheets transfers directly: start at 0.85 for names, raise it toward 0.90 when false positives appear and lower it toward 0.80 when expected pairs are missed.

Review before anything writes. Borderline pairs around the threshold deserve a human decision, because merging two companies that share a generic name is worse than leaving them apart. Save the reviewed table to a file as the audit trail, the same way the remove duplicates workflow keeps a review sheet before it deletes anything.

Run Find duplicates before the threshold is fixed.
It reports the groups and changes nothing, so the size of the problem is known before anything commits. The output is a review list: one row per duplicate group, keeping the first occurrence of each, with the source rows beside it. Take a surprising pair and lower the threshold until the expected pairs appear, then raise it back toward 0.90 when false positives creep in.


Review the groups before anything changes

Nothing reaches the org at this stage. The connector is read only, so the only thing a run can damage is your own review.
Copy the staging sheet to a normal tab before the next pull, because Pull to staging clears it and writes the fresh result over the top. Keep that copy as the audit trail, the same way the remove duplicates workflow keeps a review sheet before it deletes anything.

Borderline pairs around the threshold deserve a human decision, because merging two companies that share a generic name is worse than leaving them apart.
Mark each group you intend to merge and each group you intend to leave alone. That list, not the staging sheet, is what the next step works from.


Merge in Salesforce from the reviewed list

Merging happens in Salesforce, where the records live. Work through the reviewed groups and combine each pair there, using the list as the instruction and the staging sheet as the reference for what each record held before the merge.

Because the sheet only ever read the org, a merge that turns out to be wrong is corrected in Salesforce rather than rolled back through a tool. Keep the reviewed list after the work is done: it records which groups were considered, which were merged and which were deliberately left apart, and that is the part a native duplicate rule never gives you.
Re-run Find duplicates after the merges and the count falls to the groups you decided to keep.


Keep the pull fresh with a schedule

Duplicate groups reform as new records arrive, so the pull has to be repeated rather than treated as a one-off. Store the pull as a Flookup automation job and the scheduler runs it on a cadence, writes the fresh result to the staging sheet and resumes if a run hits the execution limit.

The setup takes one Connected App and a pass that includes connectors. The walkthrough is in Connect Salesforce to Google Sheets, the scheduler is described in Data Cleaning Automation and the reference is in the Salesforce connector documentation.


What runs where

Flookup Data Wrangler runs as a Google Sheets add-on. Standard Data Cleaning cleans the tab you are on, the connectors pull Salesforce, Airtable and SQL records into a staging sheet, and Data Cleaning Automation repeats either of those on a schedule. Write-back exists for Airtable and SQL only: those two sources accept changed rows, while Salesforce is read only by design and is edited in Salesforce itself.

Connectors are included with the Extended Pass and the Team Pass. The free tier and the Essential Pass cover Standard Data Cleaning, which is enough to prove the threshold on a sample before the org is involved.

Ready to Dedupe Salesforce Records?

Pull a sandbox object, clean it in the staging sheet and review every group before production data is involved.

Install Flookup Data Wrangler from the Google Workspace Marketplace, follow the get-started guide and read the documentation for the full workflow.


Frequently Asked Questions

Can Flookup change anything in Salesforce?

No. The Salesforce connector is read only and refuses any statement that is not a SELECT, so a cleaning run cannot modify an org. Merge the reviewed groups in Salesforce itself.

What SOQL can the connector run?

Read queries only. The connector refuses any statement that is not a SELECT, so a mistyped query cannot modify an org. Results are paged through nextRecordsUrl up to the 5,000 record cap.

How many records can I pull at once?

5,000 in one pull. The LIMIT is clamped to that cap and the pull reports when it was truncated, so split a larger object with a WHERE clause on LastModifiedDate.

Can I try the flow against a sandbox org first?

Yes. Choose Sandbox in the Salesforce card before connecting, and create a separate Connected App in the sandbox org with the same callback URL.


Run This Workflow on Your Own Data

Flookup runs inside Google Sheets: fuzzy matching, deduplication, profiling and enrichment on the rows you already have. Free tier from install with no credit card required.

Install Flookup Data Wrangler from the Google Workspace Marketplace, or open the documentation to run the formulas on sample data.


You Might Also Like