Evgeniy
Evgeniy

Reputation: 2595

importHTML with class declaration

The code =ImportHtml(“http://en.wikipedia.org/wiki/Demographics_of_India“; “table”;4) is working for me.

I want now to specify HTML element with a certain CSS class. For importXML it works like =importxml(http://example.com,"//*[@class='teaser']") - how should it work for importHTML?

Upvotes: 2

Views: 7042

Answers (1)

Kresimir Pendic
Kresimir Pendic

Reputation: 3614

I think you can't target class with ImportHtml, but I have created ImportXml in B2 & B3 cells so you can test it here and see if that helps you:

https://docs.google.com/spreadsheets/d/18QIz2fzV0iAI2rdgJqALQx_T9bJjvwyjZIwH-0bLCjI/edit?usp=sharing

=ImportXml("https://en.wikipedia.org/wiki/Demographics_of_India", "//*[@id='mw-content-text']/div[6]")

and in the B3 cell there is example with class targeting:

=IMPORTXML("https://en.wikipedia.org/wiki/Demographics_of_India", "//div[contains(@class, printfooter)]")

Upvotes: 3

Related Questions