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.
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.
- Go to the page I give you
- Find every email address on it
- Add them to my Google Sheet, no duplicates
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 pageURL: the page with the addresses on it
- 2.0
Write javascriptScript: the script below, which returns the addresses as[code-data]
- 3.0
Write data to a Google SheetSpreadsheet: your sheetDATA:[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
Scrape YouTube for GTA 6 videos into a Google Sheet
- Go to the YouTube search page
- Input the GTA 6 search terms from my Google Sheet
- Scrape the video title, link and streaming data
- Write to my Google Sheet with the search term
Scrape YouTube search results for every search term in a Google Sheet
- Read search terms from my Terms tab
- Search YouTube for each term
- Scrape the title and link of the first 10 videos
- Write them to my Videos tab with the term
Scrape links from a website into a Google Sheet
- Go to the listing page I give you
- Scrape every product link on it
- Do every page of results
- Add the links to my Google Sheet