0

Google Sheets – ImportHTML - select span inside a table data cell

I would like to select a span inside a table data cell <td> using =ImportHTML function in Google Spreadsheet.

I could successfully select the table <td> I need: =Index(ImportHTML("https://www.example.com/page/","table",1),3,4)

But this <td> contains a span and small element and I would like to extract the number inside the span – which would be "5432.34" in this example (if possible without thousands separator "'"):

<td>
<span class="price_in_table_colored">5'432.34</span> 
<small>USD </small>
</td>

How can I get this to work? I couldn't figure out how to get this working. XML path would be following:

//*[@id="wrapper"]/div[3]/div/div[2]/div[1]/table/tbody/tr[2]/td[3]/span

//or in full: 
/html/body/div[2]/div[3]/div/div[2]/div[1]/table/tbody/tr[2]/td[3]/span
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129

0 Answers0