In this article:

How to Use ImportFromWeb in Google Sheets (2024 Update)

May 8, 2024

ImportFromWeb in Google Sheets

"ImportFromWeb" is an add-on for Google Sheets that allows users to import data from the web directly into their spreadsheet. This tool enables users to extract information from websites without needing to know how to code. It works by using web scraping techniques to retrieve data from web pages and convert it into a format that can be easily manipulated and analyzed within Google Sheets.

Google Sheets ImportFromWeb Function

A common example of how such a function might be used is as follows:

=IMPORTFROMWEB(url, query)

  • url: The web address of the page you want to extract data from. This could be a single URL or an array of URLs if you're pulling data from multiple pages.

  • query: The specific instructions or selectors that define what data you want to extract from the page(s). This could involve specific HTML elements, attributes, or other identifiers that help the function locate and retrieve the desired data.

How to Use ImportFromWeb in Google Sheets

Follow the steps below to use the ImportFromWeb in Google Sheets.

1. Install the ImportFromWeb Add-on from Google Sheets' Add-ons Menu

Open Google Sheets and click on 'Extensions' in the menu. Choose 'Add-ons', then 'Get add-ons'.

importfromweb google sheets

Search for 'ImportFromWeb' and install it.

google sheets importfromweb

2. Launch ImportFromWeb from the Extensions Menu in Google Sheets

After installation, go back to 'Extensions'. Find 'ImportFromWeb' and click on it, then select 'Open sidebar' to open the add-on.

how to use importfromweb in google sheets

Select "Start" to open the add on.

3. Select Wikipedia's List of Countries by Population as the Data Source

For this example, we're using the Wikipedia page titled "List of countries and dependencies by population" as our data source. It's a straightforward table that's great for beginners.

4. Identify the Target Data within Wikipedia's Population Table

On the Wikipedia page, identify the main table listing countries by population. This table is our target for extraction. It's structured and consistent, perfect for our tutorial.

Right-click on the population table you are interested in and select "Inspect" from the context menu. This action opens the browser's developer tools, usually on the side or bottom of your browser window, and highlights the HTML code for the element you clicked on.

5. Enter the ImportFromWeb Function with Wikipedia URL and Table Query in Google Sheets

In the developer tools, look for the <table> element that corresponds to the population data. Wikipedia tables are often classified with specific classes for styling and functionality. For example, the main population table might have classes like "table" and "wikitable".

In a Google Sheets cell, type the ImportFromWeb function with the Wikipedia page URL and a query targeting the table. The query for Wikipedia's population table is "table.wikitable". The function will look like this:

=IMPORTFROMWEB("", "table.wikitable")

This command attempts to import the population table into your spreadsheet.

6. Adjust the Query or Refresh the Data if Necessary for Accurate Import

If the table doesn't appear correctly or you're not happy with the format, adjust your query. ImportFromWeb allows for adjustments and refreshes to ensure your data is current and formatted as needed.

We hope that you now have a better understanding of how to use ImportFromWeb in Google Sheets.

If you enjoyed this article, you might also like our article on how to use matrix multiplication in Google Sheets. 

If you want to get a copy of our inventory template in Google Sheets, we also suggest checking out our detailed guide. 

Get Google Sheets productivity and automation tips delivered straight to your inbox
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
We'll email you 1-3 times a week — and never share your information.
Get your copy of our free Google Sheets automation guide!
  • 27 pages of Google Sheets tips and tricks to save time
  • Covers pivot tables and other advanced topics
  • 100% free

Work less, automate more!

Use Lido to connect your spreadsheets to email, Slack, calendars, and more to automate data transfers and eliminate manual copying and pasting. View all use cases ->