Extract all links from a webpage, along with their anchors text [free SEO tool]

Author: Alan Trébuquet
Published: May 6, 2024

Today, as websites increasingly interconnect their pages with intricate links architectures, the importance of understanding and analyzing these links for SEO purposes cannot be overstated. Behind the scenes, web crawlers and search engines rely on this criteria to rank websites and index webpages effectively.

Imagine a scenario where you could effortlessly extract web links from any webpage – or even from a list of webpages – regardless of your technical expertise.

Thanks to the capabilities of the Google Sheets add-on, ImportFromWeb, this concept is now within reach.

In this blog post, we’ll delve into how this simple tool can empower SEO professionals and teams to extract all links along with their anchor text, including both internal and external, from any webpages.

Step-by-Step Guide

ImportFromWeb is a Google Sheets add-on that enables anyone to extract any data from any webpage. The process relies on a simple Google sheets function – named =IMPORTFROMWEB() that requires 2 arguments: the webpage URL and a selector or a list of selectors that describe the path to data.

The add-on fetches the webpage, parses its content and populates the spreadsheet with the data points requested.

Step 1: Open a new Google Sheets document and install ImportFromWeb

As mentioned above, we’ll use ImportFromWeb as a part of our process to extract the links. So please make sure first to install ImportFromWeb from the Google Workspace Marketplace and activate it in a new Google Sheets (from the Extension menu).

Step 2: Input the webpage URL

To work with a concrete example, let’s extract all the links from the fluor.com home page.

We simply copy and paste the URL in any cell.

Step 3: Enter the =IMPORTFROMWEB() formula to extract the links

As said before, the =IMPORTFROMWEB() function needs an URL and a list of selectors that will describe the path to data we want to get in our spreadsheet (in our case, all the links with their respective anchors text inside the webpage).

Since links are described with the selector linkUrls and anchors text with linkAnchors, this is how the formula should look like:

=IMPORTFROMWEB(A2,"linkUrls,linkAnchors")

And here are the results once the formula is executed:

Internal links – being relative – do not contain the https// and the domain name while external links are absolute.

Step 4: Scale the formula to extract links from a list of webpages

Now, you may want to analyze an entire website or reproduce this simple process on a list of webpages. Since we saw that for a single webpage the results require multiple rows to be displayed, you need to add a compare option to the =IMPORTFROMWEB() formula. The compare option comes as a 3d parameter and is very useful when you want to force each data source to be contracted into one row.

=IMPORTFROMWEB(A2,"linkUrls,linkAnchors","compare")

Now, all you have to do is to add your list of URLs below the first one, and simply drag down the =IMPORTFROMWEB() formula till your last URL.

And you’re done!

Webpages link Extractor free template

To help you get started quickly, we’ve designed a Google Sheets template integrated with ImportFromWeb. Access the Link extractor template through the provided link to start extracting webpage links effortlessly.

Make sure to previously copy the template and activate the ImportFromWeb add-on in your spreadsheet!