1

I am attempting to pull pricing from this website into Google Docs using ImportXML. The code for the element is

<div class="col-xs-8 col-sm-7 col-lg-7 col-xl-6 price"   style="color:#007b29">$644.96</div>

My formula is

=IMPORTXML(I2,"//div[@class='col-xs-8 col-sm-7 col-lg-7 col-xl-6 price']/@style='color:#007b29'")

Obviously, the link for the website is located in I2. However, this doesn't return the element ($644.96), but TRUE instead. Obviously I'm missing something here, and it feels like it should be fairly obvious.

kjhughes
  • 106,133
  • 27
  • 181
  • 240
JJ Martin
  • 11
  • 1

1 Answers1

0

ImportXML is returning true because your XPath expression is a test evaluating to true. Move @style='color:#007b29' into a predicate to instead have the XPath expression evaluate to the div with the given @class and @style attribute values:

//div[@class='col-xs-8 col-sm-7 col-lg-7 col-xl-6 price'][@style='color:#007b29']
kjhughes
  • 106,133
  • 27
  • 181
  • 240