Olympics Schedule IMPORTXML - Google Sheets

Viewed 70

UPDATE - examples clarified

How do I persuade IMPORTXML to grab either the empty <td> elements or a specific attribute three nodes down, if it exists?

--

I'm trying to pull the schedule from the Olympics website into a G Sheet for #reasons. I got as far as IMPORTHTML will not do the thing that I want, and then spent more hours than I care to mention banging my head against IMPORTXML and XPath. This is the closest I've gotten:

=importxml("https://olympics.com/tokyo-2020/en/schedule/","//[@id='schBoxInner']/table/tbody/tr")

This successfully pulls the right row headers, and apparently also all the appropriate <td> column elements into G Sheets, because if I type in the (empty) columns, I get a #REF error.

It seems to me like this should be easy - I want a table of the days events are taking place, and whether or not an event is occurring. for example, the opening ceremonies are on the 23rd (which, because of their wonky table, is column D:

21st 22nd 23rd 24th
Opening ceremonies TRUE
Basketball TRUE

The trick is that it's not a TRUE value on that date: It's <a href=blah><img=blah></a>. I just want to include SOMETHING in that cell in G Sheets, because with my previous formulation it displays...nothing.

If it's actually supposed to be this hard, please tell me now.

1 Answers
Related