是否可以使用 IMPORTXML 函数并通过查询对其进行修改?
Is it possible to use IMPORTXML function and modify it with a query?
我正在创建一个电子表格投资组合。我遇到了一些限制,例如。 G。我无法自动执行从网站导入不同股票数据的过程。这是因为网站上的股票信息索引通常与另一只股票不同。然而,有一种模式是它是定义的字符串 e 的下一个索引。 G。 "Branche"。这让我想知道我是否可以使用 Google Apps 脚本自动执行该过程。
我首先在 Google 表格中写下了这些步骤。然后我制定了 Google Apps 脚本中的步骤。现在我卡住了。
第 1 步
=IMPORTXML("https://www.comdirect.de/inf/aktien/detail/uebersicht.html?ID_NOTATION=9386126";"//tr/td[@class='simple-table__cell']")
第 2 步
=IMPORTXML(CONCATENATE("https://www.comdirect.de/inf/aktien/detail/uebersicht.html?ID_NOTATION=";"9386126");"//tr/td[@class='simple-table__cell']")
第 3 步
=INDEX(IMPORTXML(CONCATENATE("https://www.comdirect.de/inf/aktien/detail/uebersicht.html?ID_NOTATION=";"9386126");"//tr/td[@class='simple-table__cell']");62;1)
第 4 步最终产品 - 只是一个尚未实现的想法
function import_branche() {
var url1 = "https://www.comdirect.de/inf/aktien/detail/uebersicht.html?ID_NOTATION="
var ulr2
var ticker = "//tr/td[@class='simple-table__cell']"
Index = find the INDEX with the String == "Branche"
return Index(IMPORTXML(CONCATENATE(url1;url2); ticker);(Index+1);1)
}
理想情况下,我希望有一个功能,我只需要插入网站的 link 并获得结果。这里是自动找到的信息的索引。
Google Apps 脚本无法执行 Google Sheets 电子表格功能,如 IMPORTXML,因此您有两个基本选择
- 使用 Google Apps 脚本从电子表格中获取 IMPORTXML 公式的结果,然后使用 JavaScript 完成剩余的工作
- 完全使用 Google Apps 脚本和 JavaScript
完成工作
相关
- Google docs ImportXML called from script
- (javascript / google scripts) How to get the title of a page encoded with iso-8859-1 so that the title will display correctly in my utf-8 website?
我正在创建一个电子表格投资组合。我遇到了一些限制,例如。 G。我无法自动执行从网站导入不同股票数据的过程。这是因为网站上的股票信息索引通常与另一只股票不同。然而,有一种模式是它是定义的字符串 e 的下一个索引。 G。 "Branche"。这让我想知道我是否可以使用 Google Apps 脚本自动执行该过程。
我首先在 Google 表格中写下了这些步骤。然后我制定了 Google Apps 脚本中的步骤。现在我卡住了。
第 1 步
=IMPORTXML("https://www.comdirect.de/inf/aktien/detail/uebersicht.html?ID_NOTATION=9386126";"//tr/td[@class='simple-table__cell']")
第 2 步
=IMPORTXML(CONCATENATE("https://www.comdirect.de/inf/aktien/detail/uebersicht.html?ID_NOTATION=";"9386126");"//tr/td[@class='simple-table__cell']")
第 3 步
=INDEX(IMPORTXML(CONCATENATE("https://www.comdirect.de/inf/aktien/detail/uebersicht.html?ID_NOTATION=";"9386126");"//tr/td[@class='simple-table__cell']");62;1)
第 4 步最终产品 - 只是一个尚未实现的想法
function import_branche() {
var url1 = "https://www.comdirect.de/inf/aktien/detail/uebersicht.html?ID_NOTATION="
var ulr2
var ticker = "//tr/td[@class='simple-table__cell']"
Index = find the INDEX with the String == "Branche"
return Index(IMPORTXML(CONCATENATE(url1;url2); ticker);(Index+1);1)
}
理想情况下,我希望有一个功能,我只需要插入网站的 link 并获得结果。这里是自动找到的信息的索引。
Google Apps 脚本无法执行 Google Sheets 电子表格功能,如 IMPORTXML,因此您有两个基本选择
- 使用 Google Apps 脚本从电子表格中获取 IMPORTXML 公式的结果,然后使用 JavaScript 完成剩余的工作
- 完全使用 Google Apps 脚本和 JavaScript 完成工作
相关
- Google docs ImportXML called from script
- (javascript / google scripts) How to get the title of a page encoded with iso-8859-1 so that the title will display correctly in my utf-8 website?