如何在Google Sheets中把导入的数据从小数改为逗号?

问题描述 投票:0回答:1

使用 =IMPORTHTML 功能,我从一个网站导入数据到google sheets。我想导入的页面是 https:/www.tools4albion.comrefining.php?cat=ore&city=5&quantity=80&skillT4=28&skillT7=0&return=5&tax_sell=6&tax_shop=30&skillT5=17&skillT8=0&tax_order=1.5&skillT6=1。然而,该网站使用小数而不是逗号来分隔数字(不要与 "0.2 "等小数混淆)。当在Google Sheets上查看时,它产生了2个问题。

  1. 三倍小数的数字会自动向左对齐,而不是通常的右对齐。

Screenshot of Google Sheets with numbers misaligned to the left

  1. 它留下了一些非常重要的数据缩进,这完全改变了它的值(该值应该是545760,但google sheets显示为545.##)

    enter image description here

    enter image description here

  2. 对三位小数数据不能进行任何计算、函数或算术。即使是带小数的,也是作为小数而不是整数来处理。

    enter image description here

    enter image description here

对于那些想要尝试的人,我使用了公式。

=IMPORTHTML("https://www.tools4albion.com/refining.php?cat=ore&city=5&quantity=80&skillT4=28&skillT7=0&return=5&tax_sell=6&tax_shop=30&skillT5=17&skillT8=0&tax_order=1.5&skillT6=1","table",5)

有什么办法可以解决这个问题吗?如果没有这样的解决方案,存在于谷歌表。我用Microsoft Excel做这个没有问题。任何一个软件的答案我都可以接受。

xml google-sheets google-sheets-importxml
1个回答
2
投票

试试。

=ARRAYFORMULA(IF(REGEXMATCH(""&IMPORTHTML(
 "https://www.tools4albion.com/refining.php?cat=ore&city=5&quantity=80&skillT4=28&skillT7=0&return=5&tax_sell=6&tax_shop=30&skillT5=17&skillT8=0&tax_order=1.5&skillT6=1",
 "table", 5), "\d+\.\d+\.\d+$|\d+\.\d+$"), SUBSTITUTE(IMPORTHTML(
 "https://www.tools4albion.com/refining.php?cat=ore&city=5&quantity=80&skillT4=28&skillT7=0&return=5&tax_sell=6&tax_shop=30&skillT5=17&skillT8=0&tax_order=1.5&skillT6=1",
 "table", 5), ".", )*1, IMPORTHTML(
 "https://www.tools4albion.com/refining.php?cat=ore&city=5&quantity=80&skillT4=28&skillT7=0&return=5&tax_sell=6&tax_shop=30&skillT5=17&skillT8=0&tax_order=1.5&skillT6=1",
 "table", 5)))
© www.soinside.com 2019 - 2024. All rights reserved.