Bird
Raised Fist0
Google Sheetsspreadsheet~15 mins

IMPORTHTML for web tables in Google Sheets - Real Business Scenario

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
Scenario Mode
👤 Your Role: You are a sales analyst at an e-commerce company.
📋 Request: Your manager wants you to track the latest product prices from a competitor's website to compare with your own prices.
📊 Data: You have access to the competitor's public webpage that lists their products and prices in a table format.
🎯 Deliverable: Create a Google Sheet that automatically imports the competitor's product table from their website and displays it for easy comparison.
Progress0 / 7 steps
Sample Data
ProductPriceAvailability
Wireless Mouse$25In Stock
Bluetooth Headphones$45Out of Stock
USB-C Charger$30In Stock
Webcam HD$60In Stock
Gaming Keyboard$80Limited Stock
1
Step 1: Open a new Google Sheet to start your analysis.
Expected Result
A blank Google Sheet ready for data import.
2
Step 2: Identify the URL of the competitor's webpage that contains the product table.
Example URL: "https://example.com/competitor-products"
Expected Result
You have the exact webpage URL to use in the formula.
3
Step 3: Use the IMPORTHTML function to import the product table from the webpage.
=IMPORTHTML("https://example.com/competitor-products", "table", 1)
Expected Result
The first table from the webpage is imported into your sheet, showing product names, prices, and availability.
4
Step 4: Check that the imported data matches the competitor's product list and prices.
Expected Result
You see a table with columns Product, Price, and Availability matching the competitor's webpage.
5
Step 5: Format the imported data for better readability: bold headers, adjust column widths.
Expected Result
The table looks neat and easy to read.
6
Step 6: Set up a comparison column next to the imported prices to enter your own prices for each product.
In column D, enter your prices manually for each product.
Expected Result
You have a side-by-side view of competitor prices and your prices.
7
Step 7: Create a formula to calculate the price difference between your price and the competitor's price.
=VALUE(SUBSTITUTE(B2, "$", "")) - D2
Expected Result
A new column shows the numeric difference between competitor price and your price for each product.
Final Result
Product               | Price | Availability  | Your Price | Price Difference
----------------------+-------+---------------+------------+-----------------
Wireless Mouse        | $25   | In Stock     | $23        | 2
Bluetooth Headphones  | $45   | Out of Stock | $50        | -5
USB-C Charger         | $30   | In Stock     | $28        | 2
Webcam HD             | $60   | In Stock     | $65        | -5
Gaming Keyboard       | $80   | Limited Stock| $75        | 5
You can see which products you price higher or lower than the competitor.
The IMPORTHTML function keeps your sheet updated automatically when the competitor updates their webpage.
Price differences help identify where you can adjust prices to stay competitive.
Bonus Challenge

Create a conditional formatting rule to highlight products where your price is higher than the competitor's price.

Show Hint
Use a custom formula like =E2>0 to format cells in the Price Difference column with positive values.

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