How to find LinkedIn URLs directly on Google Sheets

Feb 01, 2024

Founder Avatar

Frank Jenkins

How to find prospects LinkedIn URLs using company name and job title

Finding LinkedIn URLs with just the company name and job title is incredibly useful. You can use it not only to scrape prospects, but also to personalize the cold email outreach. Two birds with one stone.

For example you can use eCold.ai to personalize this prospect list as it uses only the LinkedIn URL to craft 6 personalization for your emails.

Well in this guide we'll show you how to get prospect's LinkedIn URLs using only the Company Name and Job Tile. And don't worry, this will only take a couple minutes to set up.

The best thin is it is completely free and you can enrich up to 100 companies per day. It runs using Google Programmable Search combined with Google Search results and some query magic.

Set-up

First, you have to get an API key from Google Programmable Search to be able to do the queries. Don't worry it takes less than a minute and it's completely free.

1. Go to Programmable Search Overview

2. Under the "API Key" section, click "Get a Key"

3. In the popup, create a new project. Give it whatever name you like and save it

Create a project in Custom Search API

4. After that, click in the "Show Key" button. It will show an API key like the one below, copy it and save it.

Click show API Key and copy it

Google Sheets Script

Now we have to create the script that will run our query. Don't worry I'll give you the code so you can copy-paste it.

1. Open a Google Sheets document

2. Click on "Extensions" at the top and then click on "Apps Scripts"

Click on extensions and Apps Scripts

3. Once the script opens, replace the default function for the following code:

// Get a Custom Search API Key
// follow this link to get it https://developers.google.com/custom-search/v1/overview
const API_KEY = 'YOUR_API_KEY';
const SEARCH_ENGINE_ID = '87c12b985b8f94bda'; //eCold.ai's engine - you can use it too

/**
* Find a Linkedin profile from company name and job title
*
* @param {string} companyName company where your prospect is working
* @param {string} jobTitle job you are targeting
* @return if found the linkedinURL + Name of the prospect
* @customfunction
*/
function getLinkedInURL(companyName, jobTitle) {
try {
//Generate intitle: prefix for all words in jobTitle (works as an AND)
const jobTitleWords = jobTitle.split(" ").map(word => `intitle:${word}`).join(" ");
const query = `site:linkedin.com/in intitle:"${companyName}" ${jobTitleWords}`;

const response = UrlFetchApp.fetch(encodeURI(`https://www.googleapis.com/customsearch/v1?key=${API_KEY}&q=${query}&cx=${SEARCH_ENGINE_ID}`));
const data = JSON.parse(response);

if (data.items && data.items.length > 0) {
const url = data.items[0].formattedUrl;
const title = data.items[0].title.split("-")[0].trim();

return [[url, title]]; // Return a 2D array with one row
} else {
return [['No results found']]; // Return an empty result
}
} catch (error) {
console.error('Error fetching data:', error);
return [['Error: Unable to fetch data']];
}
}

It should look like this:

Script code

4. Then, replace at the top where it says 'YOUR_API_KEY' with the key you got on the first step (Programmable Search Key)

5. Click the save icon at the top (or press Ctrl+S) to save it.

You can now close the Script tab if you want to return to the original Google Sheet.

You're ready to use it

Your extension is now ready! You can use it directly in your Google Sheet as if it was a normal formula.

Just type

=getLinkedInURL(A2, A3)

Change A2 to the cell where the Company Name is, and change A3 to where the Job Title is. Then click enter, and watch your script do the magic!

Here's a GIF of me using it so you can see it in action:

How to find LinkedIn URLs from Company name and Job title

Now you can export this list as a CSV, and import it directly to a tool like eCold.ai to have it automatically generate personalized introductions so you can use in your cold emails. How easy is that!

You can try for free eCold.ai here

Hope you found this helpful! If you have any questions please feel free to contact us.

Personalize emails at
scale with eCold.ai

eCold.ai offers personalization for cold emailers at scale

Claim your free 20 credits