Stop Duplicate Leads with ChatGPT & Sheets (20 Min, $0)

stop duplicate leads

Where Are Your Biggest
Lead Gen Leaks in 2024?

(Generate Your Report In Just 60 Seconds)

Where Are Your Biggest
Lead Gen Leaks in 2023?

(Generate Your Report In Just 60 Seconds)

For Lead Generation & Marketing Tactics very few people, know about…

Join our Newsletter

(NO Spam or Affiliate Guarantee)

Listen – if you’re selling leads, duplicate submissions are hurting your profit margins. 

I’ve got a solution using Google Sheets and ChatGPT that’s saving our users serious cash. 

Took me 20 minutes to set up, and now it catches every duplicate before it hits their buyers.

What You’re Getting

This system will:

  • Flag duplicates before they reach your buyers
  • Show you exactly what matched (so you can prove it’s a dupe)
  • Run automatically 24/7
  • Handle thousands of leads without breaking a sweat

It’s straightforward stuff – just Google Sheets, a bit of ChatGPT magic, and you’re good to go.

This isn’t some theoretical solution I dreamed up in a board meeting. This is what I built because our users needed it, tested it, and now it’s crushing it for them.

I’m showing you how to do this in LeadsHook because that’s my software and that’s what I know inside out. 

But here’s the thing – if your system can handle webhooks and API calls, you can make this work. Period.

The whole point is to match any of your lead data – first name, last name, email, whatever – and get an instant “yep, this is a duplicate” or “nah, this is fresh” response. Then you can do whatever you want with that info.

And trust me, it’s not rocket science. If you can copy and paste (and I know you can), you can set this up.

Let me show you exactly how this works…

The Setup – Dead Simple Steps

Here’s how we’re doing this. I’m using Google Sheets as my database because it’s free and it works. 

Plus, ChatGPT is going to write all the complicated stuff for us.

Step 1: Your Google Sheet Setup

Set up your Google Sheet with whatever columns you want to check.

In my example, I’ve got:

  • First Name
  • Last Name
  • Email
  • Phone
  • Whatever else your buyers care about

But here’s the thing – you can add any columns you want. IP address? Sure. Quiz answers? Go for it. Whatever you need to check for duplicates.

Step 2: The ChatGPT Magic Script

This is where it gets good. Instead of hiring a developer or messing around with code, we’re going to get ChatGPT to do the heavy lifting.

Took me maybe 15-20 minutes to get the scripts right, including some back-and-forth refinement.

This is the script we’ll be using in the next step below.

function doGet(e) { // Extract parameters from query string var data = { lead_id: e.parameter.lead_id, first_name: e.parameter.first_name, last_name: e.parameter.last_name, email: e.parameter.email, phone: e.parameter.phone, ip_address: e.parameter.ip_address };
var result = checkForFakeLead(data);
// Return the result as JSON return ContentService.createTextOutput(JSON.stringify(result)) .setMimeType(ContentService.MimeType.JSON);}
function checkForFakeLead(data) { const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet(); const range = sheet.getDataRange(); const values = range.getValues();
let result = { fake_lead: false, fake_lead_detail: ” };
for (let i = 1; i < values.length; i++) { let matchedFields = []; if (data.lead_id && data.lead_id === values[i][0]) { matchedFields.push(`lead_id:${data.lead_id}`); } if (data.first_name && data.first_name === values[i][1]) { matchedFields.push(`first_name:${data.first_name}`); } if (data.last_name && data.last_name === values[i][2]) { matchedFields.push(`last_name:${data.last_name}`); } if (data.email && data.email === values[i][3]) { matchedFields.push(`email:${data.email}`); } if (data.phone && data.phone === values[i][4]) { matchedFields.push(`phone:${data.phone}`); } if (data.ip_address && data.ip_address === values[i][5]) { matchedFields.push(`ip_address:${data.ip_address}`); }
// Update result if there are any matches if (matchedFields.length > 0) { result.fake_lead = true; if (result.fake_lead_detail) { result.fake_lead_detail += “; “; } result.fake_lead_detail += matchedFields.join(‘, ‘); } }
return result;}
App Script for Google Sheet

If you need to customize it here’s a custom persona before you start experimenting.

You are a world class js developer and an expert in google sheets scripting.
I’m running a lead gen campaign where I want to identify scam or fake leads from a google sheet.
My google sheet contains there columns listed in order below:
lead_id, first_name, last_name, email, phone, ip_address
I want you to create a script which looks up these columns to find a match and returns a variable called, fake_lead equals true or false.  Also return back a variable called fake_lead_detail where you will return what column you found a match in.
Example.  If you match ip address then the variable matchedWith should return with pattern variable:value.  So if you match an ip_address listed as 123.123.123.123. then you’ll return ip_address:123.123.123.123.  If you find a match with first_name and ip_address then return, first_name and ip_address with its respective values. 
Don’t forget to also give the url request and list of variables we pass.  There is not need to pass every variable and I can pass any many variables as I find.  Your job is to do a search on ALL columns to find a match.
Now create the google sheet script.
ChatGPT JS developer persona

Step 3: Getting Your Script Live

  1. Open up Google Sheets
  2. Hit Tools > Extensions > Apps Script
  3. Paste in that ChatGPT-generated script
  4. Deploy that bad boy

When you deploy, Google’s going to give you a URL. Hold onto that – it’s important.

Step 4: Testing (Because Nobody Likes Broken Stuff)

Before you go live, test this thing. 

I use an app called Insomnia – it’s free, and it’ll save you a ton of headaches.

Here’s exactly what happens:

  1. You’ve got your Google Sheet URL (the one you got from deployment)
  2. Inside Leadhook, your webhook is going to pass values like:
    1. first_name=John 
    2. last_name=Smith 
    3. email=john@email.com
  3. These parameters get appended to your Google Sheet URL, so it ends up looking something like:
    1. https://your-google-script-url.com?first_name=John&last_name=Smith&email=john@email.com

Just plug in that URL Google gave you and test it out. When you hit send, it should come back with something like “fake_lead: true” and show you what it matched.

If it works in Insomnia, then you know your setup is solid. If it doesn’t, fix it here before you mess with your actual funnel.

Making This Work in Your Funnel

Alright, once you know your lookup is working, here’s where the rubber meets the road. 

I’ll show you how we do it in Leadhook, but the principle is the same anywhere:

  • Take that URL you got from Google
  • Plug it into your webhook or API call
  • Map your fields

Let’s say you’re checking first name. Your field would look something like: first_name

But here’s why this gets interesting – you can check multiple fields at once. Maybe you want to match:

  • First name AND email
  • IP address AND phone number
  • Any combination that makes sense for YOUR business
You want to place this AFTER you’ve actually collected the data you’re trying to match. (I know this sounds obvious, but you wouldn’t believe how many support tickets we get where people try to check for duplicates before they even have the lead’s info. Don’t be that person.)

Saving The Results

When you get a match, two things come back:

  1. Whether it’s a duplicate (true/false)
  2. What actually matched

Save both these things as custom fields. 

Why? Because when something goes wrong (and something always goes wrong), you’ll want to know WHY it flagged as a duplicate. 

Trust me on this one – future you will thank me.

Making It Actually Useful

Now here’s where you decide what to do with duplicates:

  • Send them down a different path
  • Show them a “nice try buddy” message
  • Sell them something else
  • Whatever makes sense for your business

The power move here is adding a transition node at the top. 

Why? 

Because this lookup might take 2-3 seconds. Not long, but long enough to make people antsy.

Add a “Looking for a great deal for you…” message while it checks. Makes the whole thing feel smooth instead of janky.

The Extra Stuff That Makes This Really Powerful

You can actually use this system to BUILD your database as you go.

Remember that ChatGPT prompt? We can expand it to say “Hey, when you DON’T find a match, add this lead to the sheet.” 

That way, your database grows automatically with every new unique lead.

Response Times and Scaling

Listen, 2-3 seconds response time isn’t bad. But here’s what happens in the real world:

  • Your sheet grows
  • More people hit your funnel
  • Things slow down

That’s why I showed you that transition node trick earlier. Add it on day one.

Troubleshooting Tips

If something’s not working:

  1. Test in Insomnia first – ALWAYS
  2. Check your field mapping
  3. Look at what actually matched (this is why we save that data)

Taking This to the Next Level

I just showed you a powerful method for handling duplicate leads. 

But here’s the thing – this is just scratching the surface of what’s possible when you really understand how to leverage these tools.

I’ve got two courses that dive deep into this stuff:

Techie SOS

This isn’t your typical “watch me click buttons” course. In Techie SOS, we cover:

  • How to build these kinds of systems from scratch
  • Using Google Sheets as a legitimate database
  • Split testing setups that actually work
  • Advanced webhook implementations
  • And a whole bunch of other technical stuff that makes your funnels smarter

Tracking SOS

This is where we get into:

  • Advanced tracking setups
  • Speed optimization
  • Real performance metrics
  • Systems that scale

Why This Matters

What I showed you today about duplicate leads – that’s something you can implement right now. It works. 

But if you’re serious about building sophisticated marketing systems, you need to understand the deeper mechanics.

That’s exactly what these courses are for. They’re specifically designed for marketers who want to:

  • Build their own solutions
  • Stop depending on expensive tools
  • Actually understand what’s happening under the hood
  • Scale their operations without breaking the bank

This system came directly from what we teach in these courses. And there’s a lot more where that came from.

Questions?

Drop by the Facebook group – we’re always discussing new implementations and solutions. And if you’re ready to really dive into this stuff, check out Techie SOS and Tracking SOS.

That’s it from me. Now go build something cool.

Article By

Nik Thakorlal

Nik Thakorlal is the founder of LeadsHook – a marketing personalisation and lead generation SaaS.

Like Our Content? Come write for us

How Sloppy Tracking Is Burning Your Hard Earned Capital

Table of Contents
Sign up to our Newsletter for Lead Gen & Marketing Tactics very few people, know about.🤐
form