Extract email addresses from a website into a Google Sheet


How to extract email addresses from a website into a Google Sheet: install the Chrome extension, click Build with Browser agent, tell the agent which page and which sheet, and follow its prompts. A working bot is built and tested in minutes, with duplicates removed.

If you want to know how the automation works: it opens the page with Go to page, finds every address in the page's HTML with a Write javascript step holding a short script, and writes the list to a sheet with Write data to a Google Sheet.

Author
Alex Barlow
Published

Build the email extraction from a description


Describe it and click the button: the agent builds and tests the email extraction in your Chrome extension, for one page; the common questions cover a list of pages and filtering by domain.

  1. Go to the page I give you
  2. Find every email address on it
  3. Add them to my Google Sheet, no duplicates
Click to launch the Chrome extension. Not installed? You can create an account and try it free.Opens the Chrome extension. Free account to try.

You need the URL of the page with the addresses on it and a Google Sheet to write to. Type sheet.new in Chrome to make one.

Build the email extraction step by step


The steps the agent builds, as the Builder shows them: each step by its name, with the fields to set under it. Add them yourself in this order in the step-by-step builder, or open the agent's result there to adjust it.

  • 1.0 Go to page
    • URL: the page with the addresses on it
  • 2.0 Write javascript
    • Script: the script below, which returns the addresses as [code-data]
  • 3.0 Write data to a Google Sheet
    • Spreadsheet: your sheet
    • DATA: [code-data]
    • Write options: Add to existing data

The script for step 2.0, pasted into Script as it is:

const links = Array.from(document.querySelectorAll('a[href^="mailto:"]'))
  .map(a => a.getAttribute('href'));
const t = document.body.innerText + ' ' + links.join(' ');
const m = (t.match(/[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,}/g) || [])
  .map(e => e.toLowerCase());
return Array.from(new Set(m)).map(e => [e]);

Common questions about extracting email addresses


Do I need to write the script that finds the email addresses?

No. Describe the extraction and the agent writes the script, builds the steps and test-runs them. Building it by hand, you paste the script above into Write javascript as it is.

How do I extract email addresses from a list of pages?

Put the URLs in a sheet, add Read data from a Google Sheet and Loop through data, and move the three steps inside the loop with Enter URL from the current row. To collect the URLs first, see scrape links from a website.

Can I save the email addresses to Excel or a CSV file instead?

Yes. Swap the last step for Write data to an Excel sheet or Export to CSV, with [code-data] as the data. Or keep the Google Sheet and download it with File > Download.

How do I only get email addresses from one domain?

Filter the list in the script's last line. To keep only addresses at example.com:

return Array.from(new Set(m)).filter(e => e.endsWith('@example.com')).map(e => [e]);

Why are no email addresses found?

Usually the page loads its content after the first paint. Add a Wait step before Write javascript. The script reads what the page shows: an address in a collapsed section or behind a button is found only once it is open, so add a Click element step to open it first. Addresses written as "name at example dot com" are not addresses to the script, so it cannot see them. When a run fails, hand it to the agent and it repairs the step. See common errors for what the builder reports.

Can I extract email addresses from a website without code?

Yes, in the sense that you write none: the agent writes the one script the extraction needs, and the other two steps are no-code steps. Pasting the script above by hand needs no changes either.

Can I run the email extraction on a schedule?

Yes. Save the automation and set a schedule. Each run adds what it finds under the earlier rows, so a page that gains addresses is picked up; the script removes duplicates within a run, not across runs.

Where do I get help?

Get in touch with support, or ask in the axiom.ai community. Use what you collect sparingly: an unexpected email list is spam to the people on it.

Related guides