← All Apps Scripts templates
Find LinkedIn url from first name and last name

Find LinkedIn url from first name and last name

  1. Create a new Google Sheets file
  2. Go to the API JSON Custom Search url from Google
  3. Click on "Get a key"
  4. Copy your API key and paste it instead of
  5. Go to Extensions → Apps Script
  6. Remove all the code and copy-paste the following instead of YOUR CUSTOM SEARCH API KEY
  7. Then, you need another API key from Programmable Search Engine from Google
  8. Click on "Add" to create a new Search Engine
  9. Name your search engine then select Search the entire web
  10. Done, then click to Customize
  11. Once your on the customize page, find your Search Engine ID
  12. Copy this ID and paste it in the Apps Script code instead of YOUR SEARCH ENGINE ID
  13. Save your project and go back to your sheet
  14. Create one column with the CompanyName and another one for the jobTitle
  15. Fill the company name and job title of your leads
  16. Expand the column
  17. Use =getPerson(companyName,jobTitle), like classic Google Sheets Formula

The new formula in Google Sheets:


The code to paste in Apps Script inside Google Sheets:

 * 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 getPerson(companyName,jobTitle) {

// Get a Custom Search API Key
// follow this link to get it https://developers.google.com/custom-search/v1/overview

// Create a Programmable Search Engine
//follow this link to create it -> https://programmablesearchengine.google.com/
let searchEngineId = "YOUR SEARCH ENGINE ID"

// Save your project and it's ready to use 

let search = "site:linkedin.com/in intitle:"+jobTitle+" "+companyName

// Call Google Custom Search API
var options = {
  'method' : 'get',
  'contentType': 'application/json',
response = UrlFetchApp.fetch("https://www.googleapis.com/customsearch/v1?key="+key+"&q="+search+"&cx="+searchEngineId, options);

// Parse linkedin URL and Name
let url = JSON.parse(response).items[0].formattedUrl
let title = JSON.parse(response).items[0].title.split("-")[0]

// display the results in 2 columns
var results = new Array(1);
let info = new Array(2);

return results

Reach us if the process is unclear or if the script is outdated
Apps Scripts template

Find LinkedIn url from first name and last name

Last updated
Built by
Avatar Placeholder

Similar Apps Script for


in Google Sheets