Dashboard Mode - IMPORTXML for structured data
Dashboard Goal
Track the latest headlines and their publication dates from a news website using IMPORTXML to fetch structured data automatically.
Jump into concepts and practice - no test required
Track the latest headlines and their publication dates from a news website using IMPORTXML to fetch structured data automatically.
| Headline | Publication Date |
|---|---|
| Global Markets Rally on Economic Optimism | 2024-06-10 |
| New Tech Innovations Unveiled at Conference | 2024-06-09 |
| Climate Change Summit Reaches Agreement | 2024-06-08 |
| Sports Championship Finals Scheduled for July | 2024-06-07 |
| Healthcare Advances Improve Patient Outcomes | 2024-06-06 |
=COUNTA(A2:A6)=IMPORTXML("https://example-news-site.com", "//h2[@class='headline']") in A2=IMPORTXML("https://example-news-site.com", "//time[@class='pubdate']/@datetime") in B2=INDEX(A2:A6, MATCH(MAX(B2:B6), B2:B6, 0))+----------------------+-------------------------+ | Total Headlines (KPI) | Latest Headline (KPI) | +----------------------+-------------------------+ | | | Headlines and Dates Table | | | +------------------------------------------+
Add a date filter to select a range of publication dates. When the filter changes, the Headlines and Dates Table updates to show only news within that range. The Total Headlines and Latest Headline KPIs update automatically based on the filtered data.
If you add a filter to show only headlines published after 2024-06-08, which headlines remain visible? How do the Total Headlines and Latest Headline KPIs update?
IMPORTXML function do in Google Sheets?IMPORTXML to get all <h2> elements from a webpage URL in cell A1?=IMPORTXML(A1, "//h2") uses correct XPath syntax. =IMPORTXML(A1, "//h2[]") has invalid brackets. =IMPORTXML(A1, "h2") misses the XPath axis. =IMPORTXML(A1, "//h2/@text") tries to get an attribute "text" which doesn't exist.=IMPORTXML(A1, "//h2") [OK]=IMPORTXML("https://example.com", "//ul/li"), what will the output be?=IMPORTXML("https://example.com", "//div[@class='price']") but get a #N/A error. What is the likely problem?https://news.example.com where headlines are in <h3 class='headline'> tags. Which formula correctly imports only the text of these headlines?/text() after selecting the element.=IMPORTXML("https://news.example.com", "//h3[@class='headline']/text()") correctly uses /text(). =IMPORTXML("https://news.example.com", "//h3[@class='headline']") returns the whole element including tags. =IMPORTXML("https://news.example.com", "//h3[@class='headline']/@text") tries to get an attribute 'text' which doesn't exist. =IMPORTXML("https://news.example.com", "//h3[@class='headline']/innerText") uses invalid XPath syntax.