【问题标题】:Google Sheets' IMPORTXML breaks randomlyGoogle 表格的 IMPORTXML 随机中断
【发布时间】:2019-10-09 19:04:25
【问题描述】:

我正在写作,因为我在使用 Google 表格中的以下 IMPORTXML 公式时遇到了一些问题:

=IMPORTXML("http://xmltestmagicplan.000webhostapp.com/xml_test.xml","/catalog/book[2]")

该公式在大多数情况下都可以正常工作,但大约每天一次它会中断,在加载公式时显示错误并因此给出#N/A

解决方法是更改​​ URL 中的任何内容(即 http -> https000webhostapp.com -> 000webhostapp.org),然后将其更改回来。基本上我认为解决方法是强制 Google 表格重新加载公式。

如果我使用这个公式,也会发生同样的事情:

=IMPORTXML("http://xmltestmagicplan.000webhostapp.com/xml_test.xml")

以下公式没问题:

=IMPORTXML("https://gist.githubusercontent.com/Ram-N/5189462/raw/46db0b43ad7bf9cbd32a8932f3ab981bd4b4da7c/books.xml","/catalog/book[2]")

=IMPORTXML("https://gist.githubusercontent.com/Ram-N/5189462/raw/46db0b43ad7bf9cbd32a8932f3ab981bd4b4da7c/books.xml")

我认为问题是由于我正在使用的托管 (000webhostapp.com) 造成的,但我不知道为什么。有什么想法吗?

【问题讨论】:

  • 我在=importrange()=indirect() 上遇到过类似的问题。很难依赖这些功能。
  • @a-burge,我尝试了 player0 建议的解决方法,目前似乎可行。

标签: google-sheets hosting web-hosting google-sheets-formula google-sheets-importxml


【解决方案1】:

你可以尝试这样欺骗它:

=IFERROR(
 IMPORTXML("http://xmltestmagicplan.000webhostapp.com/xml_test.xml", "/catalog/book[2]"), 
 IMPORTXML("http://xmltestmagicplan.000webhostapp.com/xml_test.xml", "/catalog/book[2]"))

或者如果切换速度太快,在like之间添加1个假切换:

=IFERROR(IFERROR(
 IMPORTXML("http://xmltestmagicplan.000webhostapp.com/xml_test.xml", "/catalog/book[2]"), 
 IMPORTXML("http://xmltestmagicplan.000webhostapp.ORG/xml_test.xml", "/catalog/book[2]")),
 IMPORTXML("http://xmltestmagicplan.000webhostapp.com/xml_test.xml", "/catalog/book[2]"))

【讨论】:

  • 谢谢,这听起来是个好主意。我会试一试,我会告诉你的。
猜你喜欢
  • 1970-01-01
  • 2019-03-15
  • 1970-01-01
  • 1970-01-01
  • 2016-02-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多