0
0
Google Sheetsspreadsheet~20 mins

IMPORTXML for structured data in Google Sheets - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
IMPORTXML Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
📊 Formula Result
intermediate
2:00remaining
Extracting all headlines from a news website
You want to extract all the main headlines from a news website using IMPORTXML. The headlines are inside <h2> tags with class 'headline'. Which formula will correctly extract these headlines?
A=IMPORTXML("https://example-news.com", "//div[@class='headline']")
B=IMPORTXML("https://example-news.com", "//h2[@class='headline']")
C=IMPORTXML("https://example-news.com", "//h1[@class='headline']")
D=IMPORTXML("https://example-news.com", "//headline")
Attempts:
2 left
💡 Hint
Remember that IMPORTXML uses XPath syntax to select elements by tag and attribute.
📊 Formula Result
intermediate
2:00remaining
Extracting all links from a webpage
You want to get all URLs from the links (<a> tags) on a webpage using IMPORTXML. Which formula will return the href attribute of all <a> tags?
A=IMPORTXML("https://example.com", "//href")
B=IMPORTXML("https://example.com", "//a/href")
C=IMPORTXML("https://example.com", "//a/@href")
D=IMPORTXML("https://example.com", "//a[href]")
Attempts:
2 left
💡 Hint
To get attribute values in XPath, use @attribute_name.
Function Choice
advanced
2:00remaining
Choosing the right XPath to extract product prices
A webpage shows product prices inside <span> tags with class 'price'. Which XPath expression will correctly extract all prices using IMPORTXML?
A//span[@class='price']
B//span[class='price']
C//span[@class=price]
D//span[@class='Price']
Attempts:
2 left
💡 Hint
XPath attribute values must be in quotes and attribute name is case-sensitive.
🎯 Scenario
advanced
2:00remaining
Handling dynamic content with IMPORTXML
You try to use IMPORTXML to get data from a webpage, but the formula returns #N/A with 'Imported content is empty'. The webpage content is loaded dynamically by JavaScript after page load. What is the best explanation?
AIMPORTXML cannot extract data generated by JavaScript after page load because it fetches only static HTML.
BThe XPath expression is incorrect and does not match any elements.
CThe website blocks IMPORTXML requests with a firewall.
DThe spreadsheet has reached its formula limit and cannot process more IMPORTXML calls.
Attempts:
2 left
💡 Hint
Think about how IMPORTXML fetches webpage data and what it can see.
data_analysis
expert
2:00remaining
Counting the number of items extracted by IMPORTXML
You use the formula =IMPORTXML("https://example.com/products", "//div[@class='item-name']") to get product names. The result fills cells A1:A10. What is the formula to count how many product names were extracted?
A=ROWS(A1:A10)
B=COUNT(A1:A10)
C=COUNTIF(A1:A10, "*")
D=COUNTA(A1:A10)
Attempts:
2 left
💡 Hint
Think about which function counts non-empty cells regardless of data type.