如何克服Google表中的字符显示限制,例如使用ImportXML时?

发布于 2025-02-12 04:51:37 字数 2286 浏览 3 评论 0原文

原始标题:

如何使用Google表公式导入数据(使用EG ImportXML)而不会在结果中删除字符?

在下面的ThrID更新中的Google Sheet示例。

我目前使用以下公式从Coingecko网站上提取加密货币的价格。该公式与价格不长的价格合理。但是,这种加密货币具有很低的价值,因此价值很长。长在字符的数量中。

例如,当前价格为$ 0.000000000086801(18个字符),

但是使用ImportXML,它显示出$ 0.000000000087(15个字符),

换句话说,它在价格结束时缺少三位数。我猜这可能与显示最多15个字符的一定限制有关。尽管我认为这仅适用于数字值,但导入XML将价格显示为文本。

是否有使用importxml(或其他公式/方式)的解决方案或解决方案,以使Google表显示完整/精确的价格,如网站上所示,而不会删除字符/数字?

公式: = importxml(“ https://www.coingecko.com/en/coins/nekocoin”,“” // div [contains(@data-controller,'coins-information'coins-information')] // span [ data-coin-symbol,'nekos')]”)

更新1

下面的公式设法拉出超过15个字符的文本(尽管包括空格),因此不确定这是否是与字符限制有关的问题...

= importxml(“ https://www.coingecko.com/en/coins/coins/bnb”,“ // h2 [ @class ='Tw-Text-LG PX-3 MD:TW-TEXT-2XL TW-FONT TW-TEXT-GRAY-900 DALK:TW-TEXT-WHITE黑暗:Tw-Text-opacity-87']”)

返回结果:“ BNB价格统计”(包括20个字符在内的20个字符),

但是,在提取价格时,问题仍然存在。

更新2

很有可能将长量显示为文本。因此,如果ImportXML默认显示出文本结果,则它不应具有数字限制...

数字单元格格式为文本没有数字限制的值

更新3

在下面的Google表是可编辑的。我已经添加了建议的解决方案,但到目前为止没有运气。

https://docs.google.com/spreadsheets/d/1kdxxgskuhfzh4nvricoa8ft_-vl6npjh1ugjzo15w4a/edit?usp = sharing

strong> strong> 4 在与 @player0进行了简短的讨论之后,ImportXML似乎在从网页的非JavaScript版本中获取数据时,价格较短。这解释了为什么它导入具有字符限制的文本。

在此处检查了这个问题( importxml-javascript?这个问题在这里( Google shees importxml expertxml return emptionxml返回空价值)似乎是不可能的。虽然可能有某种解决方法? (什么是javascript等效于importxml?)?

只需找到一个在其网页的非JS版本上产生价格的网站可能会更容易。

Original Title:

How to use Google Sheets formula to import data (using e.g. IMPORTXML) without dropping off characters in results?

Google Sheet example in thrid update below.

I currently use the formula below to pull the price of a cryptocurrency from the Coingecko website. The formula works fine with prices that are not too long. However, this cryptocurrency has a very low and hence long value. Long as in the number of characters.

E.g. the price currently is $0.000000000086801 (18 characters)

However using the IMPORTXML it shows $0.000000000087 (15 characters)

In other words, it's missing the three digits at the end of the price. I'm guessing this might be related to some limitation of displaying a maximum of 15 characters. Though I would've thought that's only applicable to number values — IMPORTXML is displaying the prices as text.

Is there a solution or workaround using IMPORTXML (or another formula/way) to enable Google Sheets to display the full/exact price as shown on the website without dropping off characters/digits?

Formula:
=IMPORTXML("https://www.coingecko.com/en/coins/nekocoin", "//div[contains(@data-controller,'coins-information')]//span[contains(@data-coin-symbol,'nekos')]")

Update 1

The formula below manages to pull text longer than 15 characters (albeit including spaces) so not sure if this is an issue related to a character limit...

=IMPORTXML("https://www.coingecko.com/en/coins/bnb","//h2[@class='tw-text-lg px-3 md:tw-text-2xl tw-font-bold tw-text-gray-900 dark:tw-text-white dark:tw-text-opacity-87']")

Returns the result: "BNB Price Statistics" (20 characters including spaces)

However, the problems still stands when pulling the price.

Update 2

It's very possible to display a long number as a text. So if IMPORTXML is showing a text result by default, it shouldn't have a digit limit...

numerical cell value formatted as text has no digit limit

Update 3

Google Sheet below is editable. I've already added a suggested solution but no luck so far.

https://docs.google.com/spreadsheets/d/1KdXXGskUhFzH4NvRiCOA8ft_-Vl6NPjh1uGJzO15w4A/edit?usp=sharing

Update 4
Following brief discussion with @player0, it seems IMPORTXML was pulling a shorter price as it pulls data from non-javascript version of the webpage. This explains why it imported a text with character limitations.

Having checked this question here (ImportXML - Javascript? Imported content is empty) and this question here (Google Sheets importXML Returns Empty Value) it doesn't seem possible. Though there might be some sort of workaround? (What is the JavaScript equivalent of ImportXML?)?

It might be easier to just find a website that produces the price on the non-JS version of their webpage.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

書生途 2025-02-19 04:51:38

尝试:

=REGEXEXTRACT(IMPORTXML("https://crypto.com/price/nekocoin", 
 "//h2/span"), "\d+.\d+")

try:

=REGEXEXTRACT(IMPORTXML("https://crypto.com/price/nekocoin", 
 "//h2/span"), "\d+.\d+")
姜生凉生 2025-02-19 04:51:38

字符串的parsefloat超过16个字符
我认为这是17个角色本身在JavaScript上的问题,图书馆也继承了此属性

parseFloat of string longer than 16 characters
i think it is problems for 17 character itself on javascript, the library inherit this property too

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文