background

Use Perplexity to Enrich Leads in Google Sheets (for $0.004)

Finding business emails is boring. Paying for them is worse.

Here’s a trick to automate that process using Perplexity AI + Google Sheets, for as little as $0.004 per lead.


💡 The core idea

You can ask Perplexity to find missing data (like emails) for leads in a spreadsheet — from directly inside Google Sheets. All you need is a well-crafted prompt, and an Apps Script that connects to the Perplexity API.

If done right:

• It’s faster than any scraping tool.

• It’s cheaper than Apollo, ZoomInfo, or Clay.

• You control the prompt and the cost.


✨ Why this works

Most enrichment tools are black boxes. You dump in leads and hope for results.

With this workflow, you craft the prompt — so you can:

• Ask for specific data points (emails, Instagram handles, LinkedIn URLs, or other strategic information)

• Tailor responses based on location or niche

• Keep costs lean by limiting the token output

I’ve generated tens of thousands of B2B emails this way, spending pennies total.


🔧 The setup

Let’s say you’ve scraped restaurant names and addresses from Google in a format like this:

A

Restaurant Name

Tikka Express

Pizza Palooza

B

Address

50 Brick Lane, London

123 High St, London

You may want to get their business email addresses. So, here’s how you do it:

Step 1: Create a Perplexity Dev Account & Get Your API Key

Before you can connect Perplexity to Google Sheets, you need to create a Perplexity Developer account and get an API key. Think of this key like a password that lets your Google Sheet talk to Perplexity behind the scenes.

Here’s why it matters:

When you send a prompt like “What’s the email for this restaurant?”, Google Sheets needs permission to access Perplexity’s brain (their AI model). The API key gives you that access.

Here’s how to do it:

  1. Go to developer.perplexity.ai
  2. Sign in with Google or email
  3. Click “Create API Key”
  4. Copy that key and keep it somewhere safe (you’ll paste it into the Apps Script in the next step)


Step 2: Install Perplexity in Google Sheets (via Apps Script)

On your Google Sheet, go to 'Tools' from the menu bar, then to 'Extensions' → 'Apps Script', and paste this in:

const PERPLEXITY_API_KEY = 'YOUR_API_KEY';

function Perplexity(prompt) {

const response = UrlFetchApp.fetch("https://api.perplexity.ai/chat/completions", {

method: "post",

contentType: "application/json",

headers: {

Authorization: "Bearer " + PERPLEXITY_API_KEY,

},

payload: JSON.stringify({

model: "pplx-7b-chat",

messages: [{ role: "user", content: prompt }],

max_tokens: 80 // control your cost here

}),

});

const json = JSON.parse(response.getContentText());

return json.choices?.[0]?.message?.content || "No response";

}


Step 3: Write your prompt in the sheet

You can use a formula to enter a prompt, asking something like:

=Perplexity("What is the email for the " & A2 & " restaurant located at " & B2 & "? Respond only with the email or 'Not found'")

This sends a live search query for each lead. Perplexity replies directly in the cell.

Keep the prompt short. Every extra word means more tokens → higher cost.


Step 4: Validate the email with AI or REGEX

To make sure the results are actually emails, (or whatever you want) you’ve got two options.

The first option is using formulas - if you're comfortable with complex formulas.

Otherwise, you can use AI to do it as just prompt it in natural language.

1. REGEX in Google Sheets:

=IF(REGEXMATCH(C2, "^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$"), "Valid", "Invalid")

2. Use GPT-4o Mini (ultra cheap): =GPT("Is this a valid business email? Just reply yes or no: " & C2)

For this solution you’ll pay a few cents per million tokens and will do this by using ChatGPT in Google Sheets via a similar Apps Script. One prompt. One API call costing fractions of cents.


💸 How Perplexity API Costs Work (and Why Prompt Design Matters)

Perplexity charges based on tokens, which are small units of text. Every time you send a prompt (input) and receive a response (output), you’re billed for the total number of tokens processed.

🧮 What Are Tokens?

For example, if your prompt is 20 tokens and the response is 80 tokens, you’re billed for 100 tokens.

💰 Token Pricing

Perplexity’s pricing varies by model. For instance, the Sonar model charges approximately $1.00 per 1 million tokens . This means a single, well-optimized request can cost as little as $0.004.

⚠️ Note: Pricing structures can change. Always refer to the official Perplexity API pricing page for the most up-to-date information.

✂️ Why Prompt Design Is Crucial

To keep costs low and responses relevant:

By crafting efficient prompts, you ensure that you’re only paying for valuable information, making your data enrichment process both cost-effective and efficient.

That's it! You should then validate the emails and start your campaigns.

Questions? Reach me on [email protected]