This guide will walk you through creating a basic alternative to Claygent using Google Sheets and Apps Script. Our tool will take a list of company names, search for their contact pages, and attempt to extract email addresses from those pages.

Tutorial Video:

https://youtu.be/w2Pp0wFa1Qw

Prerequisites

  1. A Google account with access to Google Sheets
  2. Basic understanding of JavaScript (for Apps Script)
  3. A Serper.dev API key (sign up at https://serper.dev)
  4. Email Validator tool (LeadMagic etc.)

Step 1: Set up your Google Sheet

  1. Create a new Google Sheet
  2. In cell A1, type "Company Name"
  3. In cell B1, type "Contact Page URL"
  4. In cell C1, type "Email Address"

Step 2: Set up Apps Script

  1. In your Google Sheet, go to Extensions > Apps Script
  2. Delete any code in the default Code.gs file
  3. We'll be adding our functions here shortly

Step 3: Implement the Serper.dev search function

Add the following function to your Apps Script:

function searchContactPage(companyName) {
  const API_KEY = 'YOUR_SERPER_API_KEY'; // Replace with your actual API key
  const url = '<https://google.serper.dev/search>';

  const payload = {
    'q': companyName + ' contact',
    'num': 1
  };

  const options = {
    'method': 'post',
    'headers': {
      'X-API-KEY': API_KEY,
      'Content-Type': 'application/json'
    },
    'payload': JSON.stringify(payload)
  };

  const response = UrlFetchApp.fetch(url, options);
  const result = JSON.parse(response.getContentText());

  if (result.organic && result.organic.length > 0) {
    return result.organic[0].link;
  }

  return null;
}