[英]Google Sheets = ImportXML number from website
I'm not a programmer but i'm trying to pull just 1 number into my google sheet.我不是程序员,但我只想将 1 个数字拉入我的谷歌表。
I have tried different variations of the following with no luck:我尝试了以下不同的变体,但没有运气:
= ImportXML ("https://grayscale.co/bitcoin-trust/", "// td [@ class = '"key">Bitcoin per Share<']")
It's located here: https://grayscale.co/bitcoin-trust/它位于: https : //grayscale.co/bitcoin-trust/
And the number is here:号码在这里:
<tr>
</td><td class="key">Bitcoin per Share</td>
<td>0.00096719‡</td>
<tr>
0.00096719‡
from <tr><td class="key">Bitcoin per Share</td><td>0.00096719‡</td></tr>
of the URL of https://grayscale.co/bitcoin-trust/
.要检索0.00096719‡
从<tr><td class="key">Bitcoin per Share</td><td>0.00096719‡</td></tr>
的URL的https://grayscale.co/bitcoin-trust/
。IMPORTXML()
.您想使用IMPORTXML()
将检索到的值放入 Google 电子表格的单元格中。If my understanding is correct, how about this answer?如果我的理解是正确的,这个答案怎么样? Please think of this as just one of several possible answers.请将此视为几种可能的答案之一。
=IMPORTXML(A1,"//td[../td[@class='key' and text()='Bitcoin per Share']][2]")
https://grayscale.co/bitcoin-trust/
to the cell "A1".在这种情况下,请将https://grayscale.co/bitcoin-trust/
的 URL 放在单元格“A1”中。//td[../td[@class='key' and text()='Bitcoin per Share']][2]
, the 2nd tag of the td tags, which have td class="key"
and Bitcoin per Share
, is retrieved.在//td[../td[@class='key' and text()='Bitcoin per Share']][2]
这个 xpath 中,td 标签的第二个标签,其中有 td class="key"
和Bitcoin per Share
,被检索。=IMPORTXML(A1,"//td[../td[text()='Bitcoin per Share']][2]")
can also be used.在上面的 URL 中,我认为=IMPORTXML(A1,"//td[../td[text()='Bitcoin per Share']][2]")
也可以使用。 When you want to retrieve only the value of 0.00096719
as the number, please use the following sample formula.当您只想检索0.00096719
的值作为数字时,请使用以下示例公式。
=VALUE(SUBSTITUTE(IMPORTXML(A1,"//td[../td[@class='key' and text()='Bitcoin per Share']][2]"),"‡",""))
If I misunderstood your question and this was not the result you want, I apologize.如果我误解了您的问题并且这不是您想要的结果,我深表歉意。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.