用另一个importxml更新在Google表格中使用importxml提取的数组中的数据。

huangapple go评论66阅读模式
英文:

Updating data in an array pulled with importxml in google spreadsheet with another importxml

问题

I have an importxml code that fills in between the lines A3:A11 in google spreadsheet =IMPORTXML("https://www.enucuzgb.com/";"//tbody/tr/td[6]") this code pulls price table from one site, from other sites. But since some of the prices on this site are not up to date, I draw the prices of those sites directly from that site. But I can't write the data I took in a line between A3:A11.

To summarize, the code above pulls the price list of 9 different sites, but since the prices of 2 sites are not up to date, I want to pull 2 sites separately.

Importxml formula that pulls data from 9 sites between A3:A11 (this formula is in cell A3);

=IMPORTXML("https://www.enucuzgb.com/";"//tbody/tr/td[6]")

Code in cell A9 that gets the price directly from a site;

=IMPORTXML("https://www.bursagb.com/knight-online-gb-c-4";"/html/body/div[1]/section[2]/div/div/div[2]/div[2]/div[3]/div[2]/button[2]")

The error given by the formula in A3 is "The result of the array is not expanded because it will overwrite the data in range A9."

(these formulas work every minute with google apps script and get current prices)

英文:

I have an importxml code that fills in between the lines A3:A11 in google spreadsheet =IMPORTXML("https://www.enucuzgb.com/";"//tbody/tr/td[6]") this code pulls price table from one site, from other sites. But since some of the prices on this site are not up to date, I draw the prices of those sites directly from that site. But I can't write the data I took in a line between A3:A11.

To summarize, the code above pulls the price list of 9 different sites, but since the prices of 2 sites are not up to date, I want to pull 2 sites separately.

Importxml formula that pulls data from 9 sites between A3:A11 (this formula is in cell A3);

=IMPORTXML("https://www.enucuzgb.com/";"//tbody/tr/td[6]")

Code in cell A9 that gets the price directly from a site;

=IMPORTXML("https://www.bursagb.com/knight-online-gb-c-4";"/html/body/div[1]/section[2]/div/div/div[2]/div[2]/div[3]/div[2]/button[2]")

The error given by the formula in A3 is "The result of the array is not expanded because it will overwrite the data in range A9."

(these formulas work every minute with google apps script and get current prices)

答案1

得分: 2

Here are the translated parts of your content:

"从总结一下,上面的代码提取了9个不同网站的价格列表,但由于其中2个网站的价格不是最新的,所以我想单独提取这2个网站。A3中的公式给出的错误是“数组的结果没有扩展,因为它会覆盖范围A9中的数据。”,我理解您期望的结果如下。

  • 您希望将=IMPORTXML("https://www.enucuzgb.com/","//tbody/tr/td[6]")中的值1到6放入单元格“A3”。同时,您还希望将=IMPORTXML("https://www.bursagb.com/knight-online-gb-c-4";"/html/body/div[1]/section[2]/div/div/div[2]/div[2]/div[3]/div[2]/button[2]")中的值放入单元格“A9”。

在这种情况下,以下修改如何?在此修改中,=IMPORTXML("https://www.enucuzgb.com/","//tbody/tr/td[6]")的XPath已被修改。

从:

=IMPORTXML("https://www.enucuzgb.com/","//tbody/tr/td[6]")

到:

=IMPORTXML("https://www.enucuzgb.com/","//tbody/tr[position()<7]/td[6]")

  • 请将此公式放入单元格“A3”。通过这样做,将检索值1到6。然后,您可以将第二个公式=IMPORTXML("https://www.bursagb.com/knight-online-gb-c-4";"/html/body/div[1]/section[2]/div/div/div[2]/div[2]/div[3]/div[2]/button[2]")放入单元格“A9”。

  • 例如,如果您想检索值从4到9,请将XPath从//tbody/tr[position()<7]/td[6]修改为//tbody/tr[position()>3]/td[6]

测试:

使用上述公式时,将获得以下结果。

用另一个importxml更新在Google表格中使用importxml提取的数组中的数据。"

英文:

From To summarize, the code above pulls the price list of 9 different sites, but since the prices of 2 sites are not up to date, I want to pull 2 sites separately. and The error given by the formula in A3 is &quot;The result of the array is not expanded because it will overwrite the data in range A9.&quot;, I understood your expected result as follows.

  • You want to retrieve the values 1 to 6 from =IMPORTXML(&quot;https://www.enucuzgb.com/&quot;,&quot;//tbody/tr/td[6]&quot;) put into cell "A3". And also, you want to retrieve the value from =IMPORTXML(&quot;https://www.bursagb.com/knight-online-gb-c-4&quot;;&quot;/html/body/div[1]/section[2]/div/div/div[2]/div[2]/div[3]/div[2]/button[2]&quot;) put into cell "A9".

In this case, how about the following modification? In this modification, the xpath of =IMPORTXML(&quot;https://www.enucuzgb.com/&quot;,&quot;//tbody/tr/td[6]&quot;) is modified.

From:

=IMPORTXML(&quot;https://www.enucuzgb.com/&quot;;&quot;//tbody/tr/td[6]&quot;)

To:

=IMPORTXML(&quot;https://www.enucuzgb.com/&quot;,&quot;//tbody/tr[position()&lt;7]/td[6]&quot;)
  • Please put this formula to cell "A3". By this, the values from 1 to 6 are retrieved. And, you can put your 2nd formula of =IMPORTXML(&quot;https://www.bursagb.com/knight-online-gb-c-4&quot;;&quot;/html/body/div[1]/section[2]/div/div/div[2]/div[2]/div[3]/div[2]/button[2]&quot;) into cell "A9".

  • For example, if you want to retrieve the values from 4 to 9, please modify xpath from //tbody/tr[position()&lt;7]/td[6] to //tbody/tr[position()&gt;3]/td[6].

Testing:

When the above formulas are used, the following result is obtained.

用另一个importxml更新在Google表格中使用importxml提取的数组中的数据。

huangapple
  • 本文由 发表于 2023年4月17日 06:35:33
  • 转载请务必保留本文链接:https://go.coder-hub.com/76030654.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定