Home > Software engineering >  Google Sheets - IMPORTXML but only if the the style is correct
Google Sheets - IMPORTXML but only if the the style is correct

Time:11-02

Not too sure how I would go about this; how would I get the import function to see stuff like styles? I assume since it's XML and not straight-up HTML, it wouldn't be possible.

<li>1</li><li>2</li><li><span style="color:red"><strong>3</strong> </span></li><li>4</li>

So out of the list, I want the import to only import ones that are either red or set to strong. Not too sure if XML can do this, and if not, would there be any other way?

XML path = /html/body/div[1]/div/article/div/div[1]/div/div/div[3]/div/div/div[2]/div[1]/ul

CodePudding user response:

you can try:

"//li[@span style='color:red']/strong"

but it all depends on the URL because JS elements are not supported

CodePudding user response:

Got away with "//li/span/strong" instead of the original XPath that I had. Thanks, @player0!

  • Related