Bird
Raised Fist0
Google Sheetsspreadsheet~20 mins

IMPORTHTML for web tables in Google Sheets - Practice Problems & Coding Challenges

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Challenge - 5 Problems
🎖️
IMPORTHTML Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
📊 Formula Result
intermediate
2:00remaining
What does this IMPORTHTML formula return?
Given the formula =IMPORTHTML("https://en.wikipedia.org/wiki/List_of_countries_by_population_(United_Nations)", "table", 1) in cell A1, what will be the output in the first row of the imported table?
AA blank cell because the table index is incorrect
BThe first country's name and population data only
CAn error because the URL is invalid
DThe header row with column titles like 'Country or area' and 'Population (1 July 2023)'
Attempts:
2 left
💡 Hint
IMPORTHTML imports the entire table including headers, not just data rows.
Function Choice
intermediate
2:00remaining
Which formula correctly imports the second table from a webpage?
You want to import the second table from https://example.com/data. Which formula will do this correctly?
A=IMPORTDATA("https://example.com/data", "table", 2)
B=IMPORTHTML("https://example.com/data", "list", 2)
C=IMPORTHTML("https://example.com/data", "table", 2)
D=IMPORTHTML("https://example.com/data", "table", 1)
Attempts:
2 left
💡 Hint
The third argument is the table index starting at 1.
🎯 Scenario
advanced
2:00remaining
You want to import a table but get a #N/A error. What is the likely cause?
You used =IMPORTHTML("https://example.com/page", "table", 1) but the cell shows #N/A. What is the most likely reason?
AThe webpage does not have any tables or the table index is wrong
BThe formula syntax is incorrect
CGoogle Sheets does not support IMPORTHTML
DYour internet connection is offline
Attempts:
2 left
💡 Hint
Check if the webpage actually contains tables and the index matches.
📊 Formula Result
advanced
2:00remaining
What happens if you use IMPORTHTML with a list type on a page with no lists?
Formula: =IMPORTHTML("https://en.wikipedia.org/wiki/List_of_countries_by_population_(United_Nations)", "list", 1)
What will be the result?
A#N/A error because there are no lists on the page
BThe first table on the page is imported instead
CAn empty range with no data
DThe entire webpage content is imported as text
Attempts:
2 left
💡 Hint
IMPORTHTML requires the specified element type to exist on the page.
data_analysis
expert
2:00remaining
How many rows will be imported by this formula?
You use =IMPORTHTML("https://en.wikipedia.org/wiki/List_of_countries_by_population_(United_Nations)", "table", 1). The first table has 235 rows including the header. How many rows will appear in your sheet?
A234 rows excluding the header row
B235 rows including the header row
C236 rows because an extra empty row is added
DOnly the first 100 rows due to Google Sheets limits
Attempts:
2 left
💡 Hint
IMPORTHTML imports the entire table as is, including headers.

Practice

(1/5)
1. What does the IMPORTHTML function do in Google Sheets?
easy
A. It imports tables or lists from a web page into your spreadsheet.
B. It imports images from a web page into your spreadsheet.
C. It exports your spreadsheet data to a web page.
D. It creates charts based on web page data.

Solution

  1. Step 1: Understand IMPORTHTML purpose

    The IMPORTHTML function is designed to pull data from web pages, specifically tables or lists.
  2. Step 2: Identify correct data type imported

    It imports structured data like tables or lists, not images or charts.
  3. Final Answer:

    It imports tables or lists from a web page into your spreadsheet. -> Option A
  4. Quick Check:

    IMPORTHTML imports tables/lists [OK]
Hint: IMPORTHTML grabs tables or lists from URLs [OK]
Common Mistakes:
  • Thinking it imports images or charts
  • Confusing IMPORTHTML with export functions
  • Assuming it imports unstructured text
2. Which of the following is the correct syntax to import the first table from a webpage using IMPORTHTML?
easy
A. =IMPORTHTML("http://example.com", "list", 1)
B. =IMPORTHTML("http://example.com", "table")
C. =IMPORTHTML("http://example.com", "table", 1)
D. =IMPORTHTML("http://example.com", 1, "table")

Solution

  1. Step 1: Recall IMPORTHTML syntax

    The syntax is IMPORTHTML(url, query, index) where query is "table" or "list" and index is the number of the table or list.
  2. Step 2: Check each option

    =IMPORTHTML("http://example.com", "table", 1) matches the correct syntax with url, "table", and index 1. =IMPORTHTML("http://example.com", "list", 1) uses "list" instead of "table". =IMPORTHTML("http://example.com", "table") misses the index. =IMPORTHTML("http://example.com", 1, "table") has parameters in wrong order.
  3. Final Answer:

    =IMPORTHTML("http://example.com", "table", 1) -> Option C
  4. Quick Check:

    Correct syntax = IMPORTHTML(url, "table", index) [OK]
Hint: Syntax: IMPORTHTML(URL, "table" or "list", index) [OK]
Common Mistakes:
  • Omitting the index number
  • Swapping parameter order
  • Using wrong query type like "list" when table needed
3. Given the formula =IMPORTHTML("https://example.com/data", "table", 2), what will it do?
medium
A. Import the first list from the webpage at https://example.com/data
B. Import the second table from the webpage at https://example.com/data
C. Import the second list from the webpage at https://example.com/data
D. Import the first table from the webpage at https://example.com/data

Solution

  1. Step 1: Analyze the IMPORTHTML parameters

    The formula uses "table" as the query and 2 as the index, so it targets the second table on the page.
  2. Step 2: Match parameters to options

    Import the second table from the webpage at https://example.com/data correctly states it imports the second table. Options A and C mention lists, which is incorrect. Import the first table from the webpage at https://example.com/data mentions first table, which is wrong index.
  3. Final Answer:

    Import the second table from the webpage at https://example.com/data -> Option B
  4. Quick Check:

    "table" + 2 = second table imported [OK]
Hint: Index number picks which table or list to import [OK]
Common Mistakes:
  • Confusing 'table' with 'list'
  • Mixing up index numbers
  • Assuming it imports all tables at once
4. You wrote =IMPORTHTML("https://example.com", "table", "first") but get an error. What is the problem?
medium
A. The formula needs an extra parameter for headers.
B. The URL must end with .html to work.
C. The query parameter should be "list" instead of "table".
D. The index parameter must be a number, not text.

Solution

  1. Step 1: Check the index parameter type

    The third parameter must be a number indicating which table or list to import. "first" is text, causing an error.
  2. Step 2: Verify other parameters

    The URL can be any valid URL, no need to end with .html. The query "table" is valid. No extra parameter for headers is required.
  3. Final Answer:

    The index parameter must be a number, not text. -> Option D
  4. Quick Check:

    Index must be numeric [OK]
Hint: Index must be a number, not words [OK]
Common Mistakes:
  • Using text instead of number for index
  • Thinking URL must end with .html
  • Adding unnecessary parameters
5. You want to import the third table from a webpage but the page has only two tables. What will =IMPORTHTML("https://example.com", "table", 3) return?
hard
A. It will return an error indicating the table does not exist.
B. It will import the second table instead.
C. It will import an empty table with no data.
D. It will import the first table by default.

Solution

  1. Step 1: Understand IMPORTHTML behavior with invalid index

    If the index number is higher than the number of tables on the page, IMPORTHTML cannot find the requested table.
  2. Step 2: Result of requesting non-existent table

    Google Sheets returns an error because the requested table does not exist; it does not default to another table or return empty data.
  3. Final Answer:

    It will return an error indicating the table does not exist. -> Option A
  4. Quick Check:

    Invalid index causes error [OK]
Hint: Index must not exceed available tables [OK]
Common Mistakes:
  • Assuming it imports closest available table
  • Expecting empty data instead of error
  • Thinking it defaults to first table