How to Find Contact LinkedIn Profiles in Google Sheets
By adding a small script to Google Sheets and using Serper’s search API, you can automatically retrieve LinkedIn profile URLs for your contacts before importing them into your CRM.
Overview
Before importing contacts into your CRM, having each person's LinkedIn profile URL ensures cleaner data, better match rates, and smoother automation inside LinkedIn for Workflows. This guide shows you how to automatically find LinkedIn profile URLs in Google Sheets using a simple Apps Script powered by Serper, a lightweight Google Search API.
This method works whether you have a contact’s name, company, title, email, or even a partial set of details. The script searches Google on your behalf and extracts the correct LinkedIn profile URL for each row.
The process takes about 5 minutes to set up and can enrich hundreds of rows automatically.
1. Prerequisites
To follow this guide, you will need:
- A Google Sheet containing contacts (Name, Email, Company, Job Title, City)
- A Google account with access to Apps Script
- A Serper API Key
Get it here: https://serper.dev/
Serper provides a 2,500-credit free tier, which is more than enough for testing. Paid tiers are available for higher volume:
- Starter: $50 / 50k credits
- Standard: $375 / 500k credits
- Scale: $1250 / 2.5M credits
- Ultimate: $3750 / 12.5M credits
Each search consumes 1 credit, and credits last for six months.
2. Create Your Serper API Key
- Go to https://serper.dev/
- Sign up and create a free account
- Copy your API key https://serper.dev/api-keys
You will paste this key into the script in the next step.
3. Add the LinkedIn Lookup Script to Google Sheets
- Open your Google Sheet
- Select Extensions → Apps Script
- Delete any default script in the editor
- Paste in the code snippet below
function getPerson(companyName, jobTitle, email, name, city) {
var apiKey = "YOUR_SERPER_API_KEY";
// --- Build clean search query ---
let searchTerms = [];
if (jobTitle) searchTerms.push(jobTitle);
if (companyName) searchTerms.push(companyName);
if (name) searchTerms.push(name);
if (city) searchTerms.push(city);
searchTerms.push("+ LinkedIn");
let search = searchTerms.join(" ");
// --- API URL ---
var url = "https://google.serper.dev/search?q=" + encodeURIComponent(search);
var options = {
"method": "get",
"headers": {
"X-API-KEY": apiKey,
"Content-Type": "application/json"
},
"muteHttpExceptions": true
};
var response = UrlFetchApp.fetch(url, options);
var json = JSON.parse(response.getContentText());
// --- No results returned ---
if (!json.organic || json.organic.length === 0) {
return [["No LinkedIn Profile Found"]];
}
// --- Filter to valid LinkedIn profile URLs ---
let validProfiles = json.organic.filter(item => {
if (!item.link) return false;
let url = item.link.toLowerCase();
// Must contain linkedin.com/in/
if (!url.includes("linkedin.com/in/")) return false;
// Reject non-user URLs
if (url.includes("linkedin.com/company/")) return false;
if (url.includes("linkedin.com/school/")) return false;
if (url.includes("linkedin.com/posts/")) return false;
if (url.includes("linkedin.com/jobs/")) return false;
if (url.includes("linkedin.com/pub/")) return false;
return true;
});
// --- No valid profiles ---
if (validProfiles.length === 0) {
return [["No LinkedIn Profile Found"]];
}
// --- Use the first valid profile ---
var result = validProfiles[0];
var profileUrl = result.link || "";
var title = result.title || "";
var snippet = result.snippet || "";
// Extract clean display name (usually full name)
var cleanTitle = title.split(" - ")[0].trim();
// Extract About / snippet text
var aboutSection = snippet.split("…")[0] || snippet;
// Extract location if format contains "•"
var location = "";
if (snippet.includes("•")) {
location = snippet.split("•")[1].trim();
}
// --- Return simplified result set ---
return [[
profileUrl, // LinkedIn Profile URL (primary value)
cleanTitle, // Name for verification
aboutSection, // Partial description for context
location // Location for verification
]];
}- Replace
"YOUR_SERPER_API_KEY"with your actual API key - Click Save
Your Google Sheet is now ready to retrieve LinkedIn profiles.
4. Use the Formula in Your Google Sheet
The script adds a custom function you can call directly in any cell with the =getPerson function and the cell range in brackets. For example on row 2:
=getPerson(A2, B2, C2, D2, E2)Where:
- A2 = Name
- B2 = Email
- C2 = Company
- D2 = Job Title
- E2 = City
You can include as many or as few inputs as you have. The more details you provide, the more accurate the result.
Example Layout:
After pressing Enter, the script will return up to four columns:
- LinkedIn Profile URL (primary value used later in your CRM)
- Clean title (usually full name)
- Snippet / partial about text
- Location
Apply the formula down your sheet to enrich your full contact list.
5. Why This Matters for LinkedIn for Workflows
Having accurate LinkedIn profile URLs before importing contacts into your CRM ensures:
- consistent matching with LinkedIn data
- fewer failed automation steps
- faster profile retrieval
- better enrichment accuracy
- lower API usage inside your CRM
Most workflow actions, such as Search User, Retrieve User Profile, and messaging actions, perform best when a valid LinkedIn URL or associated identifiers are available.
This simple enrichment step dramatically improves reliability and reduces costs inside your automation workflows.
6. Troubleshooting
The formula returns “No LinkedIn Profile Found”
Try adding more fields:
- City
- Company
- Job title
The more details provided, the more precise the search becomes.
LinkedIn URL is not the correct person
Use the additional returned fields (name, snippet, location) to verify accuracy. Adjust your inputs to better refine the match. Unfortunately there is no way to ensure the records returned are 100% accurate and therefore some oversight is advised.
The script does not run
- Confirm your Serper API key is active
- Ensure it is placed inside the script exactly as generated
- Check that you saved the script before running the formula
I am hitting the Serper free limit
The free tier allows 2,500 credits. If you are enriching large datasets, consider upgrading to the Starter tier.
Summary
By adding a small script to Google Sheets and using Serper’s search API, you can automatically retrieve LinkedIn profile URLs for your contacts before importing them into your CRM. This ensures cleaner data, more reliable workflow automation, and better enrichment results inside LinkedIn for Workflows.