Import Webpage data into Google Sheets using IMPORTHTML (2024)

Welcome!

Import Webpage data into Google Sheets using IMPORTHTML (2)

Recently I was working on a project where I wanted to get some data from a website for my college project. Normally, I would have just copy-pasted that data into my sheet. That's where I stumbled over multiple solutions to the problem, such as using Google Apps Script, using the IMPORTHTML formula in Google Sheets and more.

In this blog we will be discussing the various ways of importing webpage data into your Google Sheets.

So let’s get started.

In one of my previous YouTube shorts I had given you a glimpse of how I used the IMPORTHTML formula to import data for my college project.

In this blog we will be covering the following ways using which you can import webpage data into your Google Sheet.

  1. Import a table or list using the IMPORTHTML formula
  2. Import a table using cell reference inside the IMPORTHTML formula
  3. Use the Query function with the IMPORTHTML formula to get custom data
  4. Use Google Apps Script to import data

The IMPORTHTML formula is used to import data from a table or list with an HTML page. Normally, to import data from various websites, we copy/paste the data into our Google Sheet. Using the IMPORTHTML formula all you have to do is specify the link for the database and your data will get transferred to your Google Sheet.

Given below is the syntax for the formula, lets understand what goes into this formula.

Import Webpage data into Google Sheets using IMPORTHTML (3)
  1. URL : Here you have to specify the target url where the database is present.
  2. Query : In the IMPORTHTML formula, you can either import the table or a list of table available on the website. In the query section of the formula you have specify whether you want to import a table or list.
  3. Index : Your webpage can have more than 1 table, so here you specify which database you want to import into your Google Sheet.

Now that we have understood the structure of the formula, lets take a look at it in action.

Import a Table using the IMPORTHTML formula

To see the IMPORTHTML formula in action we are going to start off by importing a table from a website.

For this blog, I will be using Netflix database that is available on wikipedia and a Google Sheet. If you want to work with the Google Sheet, click here.

https://en.wikipedia.org/wiki/List_of_Netflix_original_films_(2021)
Import Webpage data into Google Sheets using IMPORTHTML (4)

This is the database that we are going to import into our Google Sheet using the IMPORTHTML formula.

Once you open up the Google Sheet, go to a cell and type in the IMPORTHTML formula which will bring up the following.

Import Webpage data into Google Sheets using IMPORTHTML (5)

Here you start out by specifying the url of the database.

Import Webpage data into Google Sheets using IMPORTHTML (6)

After specifying the url of the database, you have to specify whether you want to import the table or import the list of tables on the website. For now just specify table in the query section of the formula.

Import Webpage data into Google Sheets using IMPORTHTML (7)

Next, we specify the index of the table we want to import into the Google Sheet. For this example I want to get the first table from the website, hence I entered the index 1.

After setting the appropriate features, go ahead and hit enter.

Import Webpage data into Google Sheets using IMPORTHTML (8)

On clicking enter you will see that the data from the webpage has successfully come into the Google Sheet. This means the IMPORTHTML formula has worked.

Import a List using the IMPORTHTML formula

Now that we saw how to import a table into your Google Sheet, now let’s take a look at how to import a list into your Google Sheet using the IMPORTHTML formula.

Everything is going to be the same as but you have to change the query section to list, show below.

Import Webpage data into Google Sheets using IMPORTHTML (9)

After making the appropriate changes, go ahead and hit enter.

Import Webpage data into Google Sheets using IMPORTHTML (10)

On clicking enter, you will see that the list of tables present on the website are listed in the sheet. Here the list of tables have been printed successfully using the IMPORTHTML formula.

In the previous examples we saw how we can import data from webpages using the IMPORTHTML, where we were putting all the parameters inside the formula. Now we are going to look at how to import using cell referencing inside the IMPORTHTML formula.

Import Webpage data into Google Sheets using IMPORTHTML (11)

We are going to start off by declaring the link of the target web page from which you want to import your data. Next we declare the type of data you want to import. It can either be a table or a list. After declaring the URL and the query, go ahead and declare the index of the table you want to import.

Now that we have everything setup, lets go ahead and reference the cells inside the IMPORTHTML formula.

Import Webpage data into Google Sheets using IMPORTHTML (12)

Here I have declared the IMPORTHTML formula where I have passed the cells inside the formula. The formula first accepts the url of the webpage, followed by the query and the index of the table you want to import.

Import Webpage data into Google Sheets using IMPORTHTML (13)

On clicking enter you will see that the data from the webpage has successfully come into the Google Sheet.

The same can be done for importing a list into your Google Sheet using cell referencing inside the IMPORTHTML formula.

Import Webpage data into Google Sheets using IMPORTHTML (14)

All you have to do is change the query to list and the formula will import the list of tables present on the target webpage.

Import Webpage data into Google Sheets using IMPORTHTML (15)

Here you can see the formula has successfully imported the list of tables into your Google Sheet.

Now that we have learned how to get data from webpages into your Google Sheet using the IMPORTHTML formula in two different ways. It’s time to see how you can import custom data into your Google Sheet using the query function inside the IMPORTHTML formula.

Import Webpage data into Google Sheets using IMPORTHTML (16)

Here I have started out by putting the query formula followed by the IMPORTHTML formula. Next you have to specify the URL, query followed by the table index.

Import Webpage data into Google Sheets using IMPORTHTML (17)

After specifying the parameters for the IMPORTHTML formula, lets go ahead and declare the custom query for the query formula.

"select * where Col2 = 'Drama'")

This is the query that I am going to use. The data that I have contains different movies from Netflix. So what I am going to do is get the movies with the Drama genre into my Google Sheet using the query formula.

The Column 2 of the data contains the genre of the movies. So in the formula we specify that we only want the movies who have the genre as Drama.

Import Webpage data into Google Sheets using IMPORTHTML (18)

On clicking enter, you will see that the movies who only have the genre as Drama come into the sheet.

Import Webpage data into Google Sheets using IMPORTHTML (19)

Here you can see that on successful execution of the formula, all the movies with the Drama genre have come into the sheet.

If you prefer watching the video, click on the link below.

In the next blog, we will be looking at how to import data into your Google Sheet using Google Apps Script.

In this blog we saw how we can import webpage data into your Google Sheet using the IMPORTHTML formula in different ways. I hope you have understood how to import webpage data into your Google Sheet. In the next blog we will be looking at how to import webpage data into your Google Sheets using Google Apps Script.

You can check out the official documentation for the IMPORTHTML formula.

Feel free to reach out if you have any issues/feedback at [email protected].

Import Webpage data into Google Sheets using IMPORTHTML (2024)

FAQs

How do I import data from a web page into Google Sheets? ›

Here's how you can use the IMPORTDATA function: Open a Google Sheets document or create a new one. Select the cell where you want the imported data to appear. In that cell, enter the following formula: =IMPORTDATA(url), replacing "url" with the actual URL of the data source you want to import.

How do I pull data from HTML to Google Sheets? ›

Import data from webpages into your Google Sheets
  1. Import a table or list using the IMPORTHTML formula.
  2. Import a table using cell reference inside the IMPORTHTML formula.
  3. Use the Query function with the IMPORTHTML formula to get custom data.
  4. Use Google Apps Script to import data.
Oct 25, 2022

How to use import HTML in Google Sheets? ›

The basic syntax of the IMPORTHTML function is =IMPORTHTML(url, query_type, index), where:
  1. url is the string representing the location of the web page to retrieve the data from.
  2. query_type specifies the type of data to fetch, which can either be “table” or “list”.
Apr 27, 2024

How to use import XML in Google Sheets? ›

How to use IMPORTXML in Google Sheets?
  1. Go to your Google Sheets and type in “=IMPORTXML” to trigger the built-in function. ...
  2. Type in the URL from the website you'd like to scrape all links. ...
  3. Include the XPath query that will scrape all links, “//@href”, between quotations marks and close with parenthesis.

How do I automatically import data into Google Sheets? ›

Import Live Data to Google Sheets: Top Methods and Tools
  1. Step 1 – Install Coefficient.
  2. Step 2 – Import Live Data.
  3. Filter, sort, and limit rows to import only the data that you want into Google Sheets.
  4. Step 3 – Schedule Automatic Data Refreshes.
Jun 16, 2023

How do I automatically copy data from a website to a Google Sheet? ›

Easily import online data into Google Sheets using built-in IMPORT functions for accurate analysis. Utilize IMPORTDATA for CSV files, IMPORTHTML for tables, IMPORTFEED for RSS, and IMPORTXML for XML data. Try Google Sheets add-ons like Coefficient, Coupler.io, and Awesome Table for seamless data importing.

How to pull data from websites? ›

The web scraping process
  1. Identify the target website.
  2. Collect URLs of the target pages.
  3. Make a request to these URLs to get the HTML of the page.
  4. Use locators to find the information in the HTML.
  5. Save the data in a JSON or CSV file or some other structured format.

How can I make an HTML page to show data from Google Sheets? ›

Pull Data From Google Sheet to HTML Table
  1. Step 1 :- Open Google Sheet.
  2. Step 2 :- Click to >> Extensions >> App Script >>
  3. Step 3 :- Create 8 file Name Given Below. ...
  4. Step 4 :- Click to Copy Below Code and Paste to Code.gs File.
  5. Step 5 :- Code.gs File Line No 12 Paste your Google Sheet ID.
Mar 23, 2022

How do I import HTML into Google Docs? ›

Select the section of the web page you want to include in your document. Press Ctrl-C on the keyboard to copy that section. Then, open the Google document you want to embed that HTML page in, right-click and select Paste. Be sure to select Paste and not Paste without formatting.

What is the difference between Importxml and Importhtml in Google Sheets? ›

IMPORTXML: This function grabs structured data from web pages. It's great for pulling specific details like prices or headlines from websites. It can be used to monitor changes in competitors' websites by tracking updates in their HTML or XML data. IMPORTHTML: This one is for fetching tables or lists from web pages.

What files can be imported into Google Sheets? ›

Google Sheets supports a wide range of file formats for importing data, including:
  • CSV (Comma-Separated Values)
  • TSV (Tab-Separated Values)
  • TXT (Plain Text)
  • ODS (OpenDocument Spreadsheet)
  • XLS (Microsoft Excel 97-2003)
  • XLSX (Microsoft Excel 2007 and later)

How to use HTML import? ›

Embedding an HTML file is simple. All we need to do is use the common „<link>“ element. Then we add the value „import“ to the „rel“ attribute. Using „href“ we attach the URL of the HTML file, just like we are used to when it comes to stylesheets and scripts.

How do I import data from a website into Google Sheets? ›

How to Use the Google Sheets IMPORTDATA Function
  1. Open Google Sheets and type the URL into a cell. How to Use IMPORTDATA in Google Sheets – Add URL.
  2. In another cell, type in the formula and use the cell with the URL as input. How to Use IMPORTDATA in Google Sheets – Add Formula.
  3. That's it. The data is in your spreadsheet.
Mar 13, 2024

How do I import JSON data from URL to Google Sheets? ›

Using Third-Party Add-ons

Third-party add-ons like ImportJSON offer a no-code solution to import JSON data into Google Sheets. Install the ImportJSON add-on from the Google Workspace Marketplace. After installation, use the =IMPORTJSON("URL") function directly in your Google Sheet, where "URL" is your JSON source.

What is import data in Google Sheets? ›

IMPORTDATA is a function in Google Sheets that pulls data from a CSV or TSV file, based on a given URL. You can extract data from files in TSV or CSV format published on the web, such as on a website.

How do I import data from a local file into Google Sheets? ›

In a new spreadsheet, click “File > Import”. You can either select a file from Google Drive or navigate to “Upload”, where you can drag and drop a file or select a local file.

How do I input data into Google Sheets? ›

Edit data in a cell
  1. Open a spreadsheet in Google Sheets.
  2. Click a cell that's empty, or double-click a cell that isn't empty.
  3. Start typing.
  4. Optional: To add another line within a cell, press ⌘ + Enter on a Mac or Ctrl + Enter on Windows.
  5. When you're done, press Enter.

How do I get data from another page in Google Sheets? ›

Get data from other sheets in your spreadsheet

Select a cell. Type = followed by the sheet name, an exclamation point, and the cell being copied. For example, =Sheet1! A1 or ='Sheet number two'!

Top Articles
Everything you need to know about log data
Gastrointestinal Parasites of Cats
Ffxiv Act Plugin
Inducement Small Bribe
Live Basketball Scores Flashscore
Monthly Forecast Accuweather
Identifont Upload
Hocus Pocus Showtimes Near Harkins Theatres Yuma Palms 14
Txtvrfy Sheridan Wy
Die Windows GDI+ (Teil 1)
Buckaroo Blog
Our History | Lilly Grove Missionary Baptist Church - Houston, TX
True Statement About A Crown Dependency Crossword
Espn Expert Picks Week 2
Premier Boating Center Conroe
What’s the Difference Between Cash Flow and Profit?
Driving Directions To Atlanta
7440 Dean Martin Dr Suite 204 Directions
charleston cars & trucks - by owner - craigslist
7 Fly Traps For Effective Pest Control
DoorDash, Inc. (DASH) Stock Price, Quote & News - Stock Analysis
Craigslist Panama City Fl
Tygodnik Polityka - Polityka.pl
My Homework Lesson 11 Volume Of Composite Figures Answer Key
Site : Storagealamogordo.com Easy Call
Lista trofeów | Jedi Upadły Zakon / Fallen Order - Star Wars Jedi Fallen Order - poradnik do gry | GRYOnline.pl
Sef2 Lewis Structure
Exl8000 Generator Battery
Walgreens Bunce Rd
Accuweather Minneapolis Radar
Lcsc Skyward
Meggen Nut
Bj's Tires Near Me
Does Royal Honey Work For Erectile Dysfunction - SCOBES-AR
Gus Floribama Shore Drugs
Xfinity Outage Map Lacey Wa
Spy School Secrets - Canada's History
Los Amigos Taquería Kalona Menu
new haven free stuff - craigslist
Bt33Nhn
Jail View Sumter
Spectrum Outage in Genoa City, Wisconsin
How Does The Common App Work? A Guide To The Common App
Go Bananas Wareham Ma
Rocky Bfb Asset
Lucyave Boutique Reviews
Walmart 24 Hrs Pharmacy
Borat: An Iconic Character Who Became More than Just a Film
Headlining Hip Hopper Crossword Clue
Diario Las Americas Rentas Hialeah
Vcuapi
Latest Posts
Article information

Author: Nathanial Hackett

Last Updated:

Views: 5898

Rating: 4.1 / 5 (52 voted)

Reviews: 83% of readers found this page helpful

Author information

Name: Nathanial Hackett

Birthday: 1997-10-09

Address: Apt. 935 264 Abshire Canyon, South Nerissachester, NM 01800

Phone: +9752624861224

Job: Forward Technology Assistant

Hobby: Listening to music, Shopping, Vacation, Baton twirling, Flower arranging, Blacksmithing, Do it yourself

Introduction: My name is Nathanial Hackett, I am a lovely, curious, smiling, lively, thoughtful, courageous, lively person who loves writing and wants to share my knowledge and understanding with you.