Skip to main content

Overview

This guide walks you through automating your prospecting process by searching and enriching contact data directly in Google Sheets using the Lusha V3 API. With this setup, you’ll be able to populate a list of contacts based on specific filters, retrieve detailed contact data, and track enrichment progress efficiently.
This guide uses the Lusha V3 API (/v3/contacts/prospecting and /v3/contacts/enrich), which is the current recommended version. If you are still using the V2 script, see the Legacy V2 Script section at the bottom of this page.

Setup Instructions

Step 1: Create a Google Sheet

Create a new Google Sheet and name the tab “Sheet1”, or update the SHEET_NAME variable at the top of the script to match your tab name.

Step 2: Add the Script

  1. In your Google Sheet, go to Extensions > Apps Script.
  2. Delete any existing code in the editor.
  3. Paste the script below and click Save (Ctrl+S / Cmd+S).

Step 3: Add Your API Key

  1. In the Apps Script editor, go to Project Settings (gear icon).
  2. Under Script Properties, add a new property:
    • Key: api_key
    • Value: your actual Lusha API key
You can find your API key in your Lusha Dashboard (admins and managers only).
Do not paste your API key directly into the script. Storing it in Script Properties keeps it secure and out of the code.

Step 4: Customize Your Filters

Before running Search Contacts, update the payload object inside populateContacts() to match your ICP. The template includes example filters for:
  • Location: United States, New York
  • Company size: 51-500 employees
You can modify or extend these filters using any of the available fields in the Lusha API documentation. After making changes, save the script.

Step 5: Refresh the Sheet and Run

Refresh your Google Sheet. You’ll see a Lusha Actions menu appear in the toolbar. When the sheet first loads, the script automatically sets up:
  • Rows 1-2: A dashboard with live counters for Total Contacts, Total Emails, Total Phones, and an estimated credit cost for the next enrichment run. Row 2 also shows the current page, last search/enrich timestamps, and the configurable Batch Size (default: 25).
  • Row 3: A spacer row.
  • Row 4: Column headers for all input and output fields.
  • Row 5+: Your data.
In column K2, a Global Override dropdown lets you control what gets revealed across all enrichments:
  • Custom (default): respects the per-row Enrich Email and Enrich Phone checkboxes.
  • Enrich Only Emails: reveals emails for all rows, regardless of checkboxes.
  • Enrich Only Phones: reveals phones for all rows, regardless of checkboxes.

Running the Script

Search Contacts

Click Lusha Actions > Search Contacts to populate the sheet with contacts matching your filters. Each run fetches one page of results (default: 25 contacts) and increments the page counter in A2 automatically, so successive runs pull the next page. Each contact is written to a new row starting at row 5, with:
  • Basic contact info in columns A-H
  • Per-row Enrich Email and Enrich Phone checkboxes in columns K-L (both checked by default)
  • Enriched status set to No in column M

Enrich Contacts

Click Lusha Actions > Enrich Contacts to retrieve full contact details for all rows where Enriched is not yet Yes. The script reads the per-row checkboxes and the Global Override setting to determine what to reveal for each contact, then groups rows into batches and sends them to the API. Results are written to columns N-AU. The Enriched column (M) updates to:
  • Yes (green) - enrichment succeeded
  • Excluded (grey) - both checkboxes were unchecked for that row
  • Error: [code] - the API returned an error for that contact
The dashboard counters and timestamps update automatically after each run.

Minimum Input Requirements for Enrichment

The enrich step uses the stable Contact ID (column J) populated by the search step. As long as Search Contacts ran successfully, no additional input is needed per row.

Data Fields Returned

Core contact columns (A-M): First Name, Last Name, Full Name, Job Title, Company Name, Company Website, Has Work Email, Has Phones, Request ID, Contact ID, Enrich Email checkbox, Enrich Phone checkbox, Enriched status. Enrichment output columns (N-AU): Emails (up to 2) with type and confidence, Phones (up to 2) with type and Do Not Call flag, Job Title, Departments, Seniority, full Location breakdown, LinkedIn URL, X (Twitter) URL, Previous Employment (title, departments, seniority, company), and Company Domain, Industry, and ID.

Troubleshooting

  • Error: Credit limit reached: Your account has no remaining credits. Add credits and re-run enrichment - already enriched rows are skipped automatically.
  • Error: Invalid API key: Confirm the key is correctly set in Project Settings > Script Properties with the key name api_key.
  • Error: Rate limit exceeded: Too many requests in a short window. Wait a moment and re-run.
  • Contacts not appearing after search: Check the Apps Script logs under View > Logs for the raw API response. Confirm your filters are valid by testing them in the Lusha API documentation.
  • Enriched column shows Excluded: Both the Enrich Email and Enrich Phone checkboxes are unchecked for that row. Check at least one to include it in the next enrichment run.

Automate with Triggers (Optional)

To run search or enrichment on a schedule:
  1. In the Apps Script editor, go to Triggers (clock icon in the left sidebar).
  2. Click Add Trigger.
  3. Choose populateContacts or enrichContacts as the function.
  4. Set the trigger type to Time-driven and choose your frequency.

Legacy V2 Script

This script uses the Lusha V2 API, which is no longer the recommended version. New integrations should use the V3 script above. The V2 script is preserved here for teams that have not yet migrated.

Additional Resources

If you have any questions, feel free to reach out to the support team: