02 September 2024 / Sales 7 Simple Steps to Optimize Lead Generation with AI Table of Contents If you're anything like me, having 10 different tabs open trying to find good leads is probably killing you inside. Fortunately for both of us though, now that AI has arrived, we can use it to optimize a lot of the lead generation process. And well, I'm not one for gatekeeping so I'm going to show you how I did it in seven steps, using ChatGPT and Google Sheets.Step 1: Get firmographic data on clientsDo you know who your customers are? Do you know them? Be it a B2B or B2C product, you need to know who's buying your services so you have an idea of who else will also buy your product. For me, I had to figure out who was using our products and where they worked to construct our ideal customer profile.Now, I could have done this the old way - looking up emails on the interwebs, digging through company websites, and searching LinkedIn profiles, hoping that our subscribers posted their information somewhere.I didn't. I used Sapiengraph instead.If you haven't heard of Sapiengraph, it's a no-code Google Sheets extension that enriches profiles directly in Google Sheets. All you have to do is create an account (and get 100 trial credits!), and add the Sapiengraph extension to your browser to enable it in Google Sheets. Sapiengraph gives you fresh B2B data directly in your sheet without needing to dig through pages and pages of information.One thing about me is that I love seeing empty cells getting filled, which is why using Sapiengraph always fills me with glee.Behold my list of (example) emails and names!Right now, I only have the names of our subscribers and the company names. That's not enough if I want to do some serious lead generation. I need more firmographic data, which are information that can be used to categorize these organizations by industry, size, or location. Since googling these things will take time, I’ll use Sapiengraph formulas to search for the information instead.Here's the thing, even a formula nerd like me can admit that sometimes, typing formulas into cells can get tedious. That's why I started using AI technology. ChatGPT is pretty good at getting things done when you give it super specific instructions.I saved the entire Sapiengraph API documentation here as a PDF file, uploaded it to ChatGPT and told it to write some formula for Google Sheets.ChatGPT Prompt: Write Sapiengraph formula for firmographic dataBased on the documentation in this file, write Sapiengraph formula to search for the following based on first name in Column A and Company name in Column D Col E: Company Profile Col F: Industry Col G: Country Col H: Company Size Col I: Funding Amount Col J: Specialities Columns F to J should reference Col E 💡Pro-Tip: Arrange the rows accordinglyI didn't want to waste time copy-pasting formulas so I told ChatGPT to put headers in Row 1 and formulas in Row 2. It placed the formula into neat little cells, which made it easy to copy and paste directly into Google Sheets!After transferring the formulas to my sheet, I waited for Sapiengraph to do its magic.Ta-da! The information I need for lead generation.Many data, very no-code, much enrich, wow.Step 2: Analyze data and get AI insightsNow that you’ve got a lovely bunch of data, you have to analyze it. Filtering out hundreds of cells then manually, copying and pasting them into another sheet, categorizing them into different sections....Yeah, no. The latest iteration of ChatGPT, GPT-4o, can analyze data quickly and more efficiently. OpenAI has a free tier that allows a limited number of file uploads and data analysis per day. I like that I don't need to think about which formulas to use to extract which data (Spreadsheet nerds will know what I mean). Sometimes it's just too tiring to think about how to nest my formulas so that I get the perfect drag and fill.Since OpenAI accepts PDF, text, excel, and CSV files, I uploaded some (example) sales data and prompted ChatGPT to do some basic analyses.ChatGPT Prompt: Enhance your sales process with AI-powered analysisThis is a list of companies that have bought our product. Generate tables to show the top industries that use our product, the top company sizes that use our products, and the top countries that use our product. 💡Pro-tip: Keep it short and simpleArtificial intelligence is smart, but it's not that smart. Use short simple sentences to specify what you want in the prompt. You can further specify how much data you want, i.e. Top 15 industries, or Top 10 countries, or if you want them sorted in a particular method.ChatGPT tends to do better with text files or CSV files because it reads them faster. It takes a bit of time with PDFs but your mileage may vary if you've got a subscription.When the analyses were done, I pasted the tables ChatGPT made into Google Sheets and generated charts to visualize the data. I'm only looking at the top countries overall, but you can also ask ChatGPT to list down the top countries by industry, or top industries in each country. Play around with the prompt to get what you need!Step 3: Develop your ideal customer profile (ICP)What I like about ChatGPT is that it learns how to respond based on your requests. Since I uploaded a text file earlier, it'll use the file's data as a basis for future replies, until I tell it to stop or start a new chat.So, I asked ChatGPT to figure out my ICPs. Since I only uploaded firmographic data about industries, sizes, and countries, its response will only mention those characteristics. However, if you upload a larger data set that involves funding, dates founded, or the type of company, ChatGPT can use the additional information to create a more comprehensive profile of your ideal customer or potential leads.ChatGPT Prompt: Segment your leads with AIBased on this data, create an ideal customer profile for target companies. There are a lot of AI tools that specialize in building leads and generating ICPs. ChatGPT can do the same on a smaller level, offering suggestions based on the files I uploaded. The more information you give it, the more detailed the report. Sometimes, its recommendations may even highlight items you may have overlooked in your data, or give you new insights you hadn’t considered before.ChatGPT Prompt: Create complete profilesList the characteristics of the top 3 ICPs I should aim for. According to ChatGPT, my main ICP should be a mid-sized technology firm that has 51-200 employees in the technology industry. Specialties include cloud computing, artificial intelligence, software development, and cybersecurity. ChatGPT also cross-referenced the data and said I should look at companies based in the United States, Japan, or Germany. The screenshot only shows two profiles but I promise you there's a third one, my screen is just small.Step 4: Find more prospects and potential customersNow that I’ve got a target ICP, I have to start looking for leads. Here’s where AI tools like ChatGPT sometimes fall short. I think everyone has noticed by now that language learning models (LLMs) tend to hallucinate when you ask them to suggest real-life companies or accounts. ChatGPT, despite being great at analyzing data, tends to lean into the generative part of its name of ‘Generative AI’ and generate fictional companies. That, or it will start making up details about existing companies to fill in any blanks it encounters.Most chat-based AI technologies like ChatGPT or Gemini operate on data from before 2023, which is less than ideal when you want to look up start-ups or companies that have recently been funded.Since I already have Sapiengraph, I used it to search for similar companies in my ICPs. Sapiengraph has a company search function that finds companies based on characteristics like location, industry, size, funding types, money raised, and many more. It has fresh profile scraping, which means the information is less than 29 days old.Well, I 'taught' ChatGPT how to use Sapiengraph to search for ICPs, so I asked it to continue generating formulas for me.Like before, I gave it really specific instructions on the sort of characteristics (or parameters) to look for. If you're not used to Excel or Google Sheets, each characteristic is like a car with a specific parking lot. You can't just park it anywhere in the formula. ChatGPT can mess up sometimes, parking the wrong car in a spot meant for a van, which is why I'm being super specific about where each trait should be parked.ChatGPT Prompt: Write a Sapiengraph formula for automated lead generationBased on the documentation, write a Sapiengraph formula for Google Sheets with these parameters Country: US. Industry: Technology. Description: Cloud Computing. Minimum Employees: 51. Maximum employees: 200. 💡Pro-tip: Be specific, very specific!Even though ChatGPT (and other AI tools) remember your data, they sometimes forget what you’re asking for, and give you Python or Javascript code. I get around this by repeatedly telling it I want a Google Sheets formula.8 out of 10 times, ChatGPT also provides a neat little explanation of why they filled in some cells and left others empty. Since I had Sapiengraph enabled, I copied and pasted ChatGPT’s output into Google Sheets again. If you’re using the 100 credits that come with the free trial, you should know that each profile Sapiengraph retrieves will cost 30 credits. This means you can only search for 3 profiles at a time. If it doesn't work, try setting the maximum profiles to 1 for the time being!Formula: =SG_COMPANY_SEARCH("US", , , , , , , , , , "Cloud Computing", 51, 200, "Technology") Cost: 30 Credits/LinkedIn Profile ReturnedEt voila! Now I've got 10 new target companies that fit my ICP. ChatGPT Prompt: Use ChatGPT as AI lead generation software to find potential leadsSearch for companies in my other ICPs Another thing I like about ChatGPT is that it can infer what I want from previous responses. I don't need to retype every single specification. This makes it easier to find leads that fit other ICPs. With a single sentence, it generated more Sapiengraph formulas to replicate the above results for other ICPs.Step 5: Enrich company data in Google SheetsIt's back to firmographic data again. I’ve got a list of company profiles, but nothing else. I need more information about my potential leads because lead enrichment is crucial for boosting sales conversion. While I can deduce the names of these companies from the URLs and their LinkedIn profiles, that’s going to take time and energy. It’s easier to use Sapiengraph formulas to enrich these profiles with the data I need in Google Sheets.To do that, I first decided on the kind of data I wanted in Google Sheets and put them into the header row so I don’t forget.Right now, I'm looking for the company's name, descriptions, industry, and specialties. I'm also going to look up a key decision maker and their email address so that I can contact them later. There are several ways you can find CEO email addresses legally, but in my opinion, Sapiengraph is easier. I searched for 'CEO's as key decision makers, but it may differ depending on your niche. Sometimes, you have better luck reaching out to the rest of the C-Suite team, or directors of smaller departments that will use your products.I only wanted Sapiengraph to start filling in my other columns with characteristics, if there’s a company LinkedIn profile in column A, so I used the ‘If’ function along with the ‘isblank’ function. The basics of the function go like this: if(isblank(cell you want to check), “what to do if it’s blank”, “what to do if it’s not blank”). This way, the search functions are only triggered when I fill the cells in A.Skip this step if you think it’s unnecessary. I prefer it because it prevents the API from consuming unnecessary credits and performing searches continuously. It saves on credits and time!ChatGPT Prompt: Use AI tools to generate spreadsheet formulaeBased on the documentation in this file, write Sapiengraph formula to search for the following based on the values in Column A. Col B: Company Name. use company enrichment tools Col C: Company Description. use company enrichment tools Col D: Industry. use company enrichment tools Col E: Specialities. use company enrichment tools Col F: CEO Linkedin Profile. Use SG_Employees, current Col G: CEO full name. Based on Col F Col H: Headline. Based on Col F Col I: Email. Use SG_Personal_email. Based on Col F Use IF(IsBlank(A2)) to delay the trigger. Make a table where Row 1 = header, Row 2 = formula. ChatGPT pulled the formulas from the Sapiengraph documentation I uploaded back in Step 1, and then substituted them in the proper parameters. Then, it rearranged the data into a table according to my specifications, along with the additional ‘isblank’ function delay.Once I had the formulas, I pasted them into Google Sheets.After that, data enrichment was just a matter of dragging all the formulas down to fill all the necessary rows.If I didn’t have this, I probably would have to spend hours looking through company websites and LinkedIn Profiles.💡Pro-tip: Aim for different key decision-makersSome smaller organizations will use terms like founder, director, or president instead of CEO, so try those if ‘CEO’ isn’t getting you any results. For larger organizations, it also pays to look up managers of smaller departments as these are the people who will be using and implementing the products you’re marketing to them!Step 6: Craft personalized emailsAfter finding prospective companies, I had to craft personalized sales messages. I know there are other AI lead generation tools out there that can do the same thing, but why sign up for another platform? You can use ChatGPT in Google Sheets instead. There are a few AI-powered tools available as Google Sheets add-ons. I decided to go with GPT for Docs™ Sheets™ Slides™ by Qualtir. While these extensions aren't exactly considered sales tools, they’re really neat if you just want to enhance your outreach efforts in the B2B lead generation pipeline.I found this particular extension by heading to `Extensions > Add-ons > Get add-ons` and then typing GPT in the search bar. After allowing it access to my spreadsheet, I was able to use GPT in Google Sheets by pressing start in the extensions tab.GPT Workspace has great customization functions within Google Sheets and a pretty reasonable subscription for the ease it brings. You can also earn free credits by giving reviews or following their social media accounts.With GPT Workspace enabled, I could then prompt ChatGPT from my Google Sheets by using the formula =GPT(“Prompt”) in any of the cells.One little problem I’ve encountered is that the GPT functions in Google Sheets cannot understand cell references if they’re within a section of text. Telling GPT to “Write an email to the CEO in A1 and offer him a demo” only begets an error message. GPT can only understand values in a prompt that’s structured like this:=GPT”(“Write an email to the CEO in” & A1 &” and offer him a demo or free trials”)Basically, if you’re referencing any cells, the cells have to be outside quote marks, or GPT doesn’t understand where to find them. That’s a little tedious because I wanted GPT to reference a few different cells. So I let ChatGPT do it for me instead.ChatGPT Prompt: Get AI technology to make your GPT promptsThese are the columns I have in my google sheets: Company profile, Company name, Company description, Industry, Specialities, CEO LinkedIn profile, CEO name, Headline, Email I'm using a GPT extension for Google Sheets that allows me to use GPT as a function. Generate a custom GPT formula that will write a highly personalized email to the CEO of the company, mention the company name, and then tell them how my data enrichment product can help their company achieve the things in their company description. Sign off with the name and position in column K. The CEO, Company_name, company description should be replaced by cell names. ChatGPT generated a custom formula and helpfully inserted all the cell references for me. I didn’t have to wrack my brain writing the formula for myself!💡Pro-tip: Edit formulas easily with AI toolsI hate getting ERROR messages in my Google Sheets. Using an ‘iferror’ function gives me a blank cell if something goes wrong. The formula works like this: If error(function you want to use, “text you want to see if there’s something wrong”). Your AI tool can both insert and edit the functions for you if you don’t want to do it manually.Custom GPT Formula: Generate a formula to write cold emails using AI tools=IF(ISBLANK(G2), "", IFERROR(GPT("Write a highly personalized email to the CEO of the company below. Mention the company name, and explain how my data enrichment product can help their company achieve the goals in their company description. Conclude the email with the name and position from column K. Here are the details: CEO Name: " & G2 & " Company Name: " & B2 & " Company Description: " & C2 & " Industry: " & D2 & " Specialties: " & E2 & " CEO LinkedIn Profile: " & F2 & " Headline: " & H2 & " Sign-off Name & Position: " & K2), "")) I had a bit of fun editing the prompt to generate different tones of voice. I also added a column where the rest of my sales and marketing team could add additional information.The first round of emails was kind of generic, so I asked GPT to write in a friendly, casual manner. I also told it about the key features of Sapiengraph for better customization.If you’re following along with this tutorial, you can try terms like “friendly”, “casual”, “neutral”, “informative”, and “urgent” to see what kind of email GPT generates. Always make sure that your outreach efforts are in line with your brand voice!The benefits of using GPT functions in Google Sheets is that changes occur in real-time, and I can easily see how the output changes depending on existing information. I don’t have to switch from app to app, or sheet to sheet, which enhances my workflow efficiency. Once I’m satisfied with the first output, all I need to do is drag the formula down to the bottom and watch the entire column populate with personalized emails. It's a huge time saver for sales professionals, whether you're making contact or closing deals.💡Pro-Tip: Freeze your formulas!GPT Workspaces allows users to freeze active formulas so that they don’t accidentally refresh. This helps keep credit usage for Sapiengraph low. I’m used to using “Ctrl+C” and “Ctrl+Shift+V” (Windows) or “Command+Shift+V” (Mac) to paste the text as values instead of formula, but this extra option is really handy if you think you wanna keep editing the formula.💡Pro-Tip: Play with Precise VS Creative writing to hook your potential customersGPT Workspace also has a function that controls the temperature of ChatGPT and maximum token usage per output. ‘Precise’ means that ChatGPT tries to follow the prompt as closely as possible. ‘Creative’ means that it will take a few liberties. Lowering the maximum token usage will prevent ChatGPT from generating an email that is too long.If you’ve read this far, you’ll know that I’ve not only found more leads in my ICPs, but I’ve also gotten fresh data on their profiles, found out their contact people, and also written emails that are ready to be sent! I can now move on to the next step in the world of sales and marketing automation.Step 7: Automate emailsEmails are an essential part of the sales process. Copying and pasting emails from Google Sheets into Gmail is not. I wanted to skip that part too. So I asked ChatGPT to make me a custom script to send emails directly from Google Sheets instead.First, I determined what I wanted the script to do: Email people based on the emails in Column I, with the subject and body of the email in J (Change these column names if you’ve set up your Google Sheets differently!).I don’t want Google Sheets to start sending emails before I’m done, so I want a specific button to determine when it sends the email. The easiest method is checkboxes. With so many potential customers, it’s easy to get lost and forget who’s been emailed before, so I also wanted the script to update the Google Sheet based on whether emails were sent and when they were sent. I also wanted to know how many emails were sent, and why an email was skipped, so I asked it to notify me for either case. Lastly, I needed a special button in my Google Sheets toolbar to click, that would send the emails immediately.ChatGPT Prompt: Email high-quality leads through Google SheetsWrite me an Appscript for Google Sheets. Send the mail if the checkbox in L is checked. After sending, update Col M with "Sent". Update Col N with "Date of the item sent". Col I: Email addresses or 'No Data' Col J: Email Subject + Body Col L: Checkboxes Add notification of how many emails were sent. Add a 'Send Emails' button to the Google Sheet. First line of Column J is the subject of the email, the rest is the body of the email. Log reasons why email is skipped in logger. I had to add the custom script manually. It’s really easy to do, just head to Extensions > Apps Script to open the script editor. Then I pasted the copied code and hit save.💡Pro-tip: Prevent accidental spamI accidentally spammed my colleagues with 5 emails before I realized that the 'Run' and 'Debug' functions in the Apps Script editor ALSO send emails. I suggest using a few temp emails as placeholders before you start mailing your leads!Custom AI generated script for sending emails from Google Sheets:function onOpen() { // Create custom menu const ui = SpreadsheetApp.getUi(); ui.createMenu('Send Emails') .addItem('Send Emails Now', 'sendEmails') .addToUi(); } function sendEmails() { const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet(); const lastRow = sheet.getLastRow(); let emailsSent = 0; for (let i = 2; i <= lastRow; i++) { // Assuming row 1 is the header row const emailAddress = sheet.getRange(i, 9).getValue(); // Column I const emailContent = sheet.getRange(i, 10).getValue(); // Column J const checkbox = sheet.getRange(i, 12).getValue(); // Column L if (checkbox) { if (emailAddress && emailAddress !== 'No Data' && emailContent) { // Splitting the email content const lines = emailContent.split('\n'); const subject = lines[0]; // First line as the subject const body = lines.slice(1).join('\n'); // Rest as the body // Sending the email MailApp.sendEmail({ to: emailAddress, subject: subject, body: body }); // Update columns M and N sheet.getRange(i, 13).setValue("Sent"); // Column M sheet.getRange(i, 14).setValue(new Date()); // Column N emailsSent++; } else { Logger.log(`Skipped email in row ${i}: No valid email address or email content.`); } } else { Logger.log(`Skipped row ${i}: Checkbox not checked.`); } } // Display notification if (emailsSent > 0) { SpreadsheetApp.getUi().alert(`${emailsSent} email(s) sent successfully.`); } else { SpreadsheetApp.getUi().alert(`No emails sent.`); } } After I saved and closed the Apps Script editor, I returned to my Google Sheet, refreshed the page, and immediately found a cute little custom menu in my toolbar, with the new function ‘Send Emails’.Now, each time I want to send an email, all I have to do is check the boxes of the leads and press ‘Send Emails’. Since I asked for notifications, the script also tells me how many emails were sent (if any) and updates other columns if I’ve already sent them.💡Pro-tip: Put your subject in the cell too!I told ChatGPT that the first line in the cell is the subject. As a result, it automatically created code that assigned the first line to the subject line and placed the rest of the text into the body of the email. Super handy!Now I can send my emails all within the comfort of Google Sheets. You can try out the GPT email generation and automated email script on the sample data that I prepared.Make a copy of this sheet and copy over the Apps Script File (Send Emails function). I’ve pre-filled Column M with the GPT prompt so as long as you add the extension, you can start using it immediately.The first time you click ‘Send Emails’ you’ll have to authorize the script. Press ‘OK’ and the script will start sending emails.💡Pro-Tip: Your emails are numbered…I wondered why there seemed to be so few people who used a custom AppScript to send emails via Google Sheets. Well, turns out personal accounts can only send up to 100 emails a day while Google Workspace accounts can send up to 1000 emails per day. It’s probably not enough for anyone who’s running extensive sales campaigns, but it works fine for me!Add AI to your workflowCongratulations! If you’ve been following along, you’ve just used AI to enhance your lead generation workflow! I know that AI has its problems and a steep learning curve. However, in my experience, it can enhance productivity, especially when it comes to data analysis and writing formulas. If you’re looking to make your B2B lead generation process a little easier, I believe these 7 steps will work for you. Sign up for Sapiengraph and let us know how it goes! Subscribe to our newsletter Subscribe Get the latest news from Sapiengraph
Sheets Template Ultimate Lead Tracker Template For Sales Teams Free Google Sheets lead tracking template for sales professionals. Easily add leads, enrich data, and monitor your sales pipeline with one-click automation
Sales B2B Sales Pipeline Stages: How We Got to $6M ARR Tips, tricks, metrics & checklists for every stage of the B2B sales pipeline
Business 5 Ninja Methods I Used to Find Competitors' Customers Choose from 7 legal methods to find your competitors' customers legally. From website scraping to pre-made tools, see real results using Intercom as an example.