Your first =IMPORTFROMWEB() function

Let’s learn how to use the IMPORTFROMWEB() function in Google Sheets and start scraping web data.
You feel more confortable discovering it on a video? Check out our video tutorial here

Preliminary steps

Install the add-on: if not installed yet, go to the install page on Google Workspace.

Activate the add-on: simply do it from the Extensions menu of your google sheets.

The function basics

The =IMPORTFROMWEB( ) function requires 2 parameters (or arguments) to extract data:

  • a data source, i.e. an URL that describes the source of your data
  • a selector, i.e. the path to the data you want to extract

Then, extracting data is as easy as typing:

=IMPORTFROMWEB("https://www.example.com", "selector")

A selector can be either: 

By the way, you can find more info on data selectors on this guide

Like any other spreadsheet functions, the arguments can be either written in quotation marks, or by referring to a range of cell(s) that contain them:

=IMPORTFROMWEB("https://www.example.com", "selector 1")
=IMPORTFROMWEB(A1, B1:B5) 

Comma or semicolon?

In Google Sheets, according to your locale settings, you may have to use commas or semicolons to separate parameters. Comma is usually the notation used in English speaking countries.

Let’s try the function!

Extract the title of a Wikipedia page

Let’s extract the page title of the Empire State Building Wikipedia page:

=IMPORTFROMWEB("https://en.wikipedia.org/wiki/Empire_State_Building","title")

Exactly the same way, we can pull any other data from the page, such as its h2 content or its Meta title (using the selector “h2” or “metaTitle”)

Extract any Amazon product details

Now let’s extract the title, price and rating from 3 Amazon listings.

1. Input as the 1st argument the range of cells containing the Amazon products URL
In our case A2:A4

1. Input as the 2nd argument the selectors from the Amazon built-in selectors list, in our example “title”, “price” and “rating”.
We write them in the following range of cells B1:D1

1.3. Validate your formula and voilà!

=IMPORTFROMWEB(A2:A4,B1:D1)

TIP: to extract a table from a website, just type “table” as the 2nd argument in your =IMPORTFROMWEB( ) function, as follow:

Video tutorial

Our video tutorial is also a good way to get started with ImportFromWeb!