← All Apps Scripts templates
Get domain from company name

Get domain from company name

  1. Create a new Google Sheets file
  2. Go to Extensions → Apps Script
  3. Remove all the code and copy-paste the following instead
  4. Get a Clearbit API Key here → https://clearbit.com/blog/company-name-to-domain-api
  5. Copy and paste the API key into your Project at line 6. It should look like this now: const clearbit_api_key = "sk_eaoifjeaojfoieajof"
  6. Click on “run” and review permissions
  7. Save your project and go back to your sheet
  8. Use =getDomain(), like classic Google Sheets Formula

The new formula in Google Sheets:


The code to paste in Apps Script inside Google Sheets:

// Set-up

// 1. Replace `YOUR_API_KEY` with your Clearbit API Key. 

const clearbit_api_key = "YOUR_API_KEY"

// 2. Save the Apps Script project
// 3. In your sheet, simply use the function =getDomain({companyName})

 * Get domain from companyName.
 * @param {string} companyName.
 * @return domainName.
 * @customfunction

function getDomain(companyName) {

  var url = "https://company.clearbit.com/v1/domains/find?name=" + companyName;
  var options = {
    "muteHttpExceptions": true,
    "headers": {
        "authorization": "Bearer "+clearbit_api_key
  var response = UrlFetchApp.fetch(url, options);
  var responseCode = response.getResponseCode();
  var responseBody = response.getContentText();
  if (responseCode === 200) {
    return JSON.parse(response).domain;

  } else {
    Logger.log(Utilities.formatString("Request failed for %s, got %d: %s", name, responseCode, responseBody));
    return false;

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

Get domain from company name

Last updated
Built by
Avatar Placeholder

Similar Apps Script for


in Google Sheets