我正在创建一个电子表格组合。我遇到了一些限制,例如我无法自动化从网站导入不同股票数据的过程。这是因为网站上股票信息的指数通常与另一只股票不同。然而,有一种模式是它是来自已定义字符串的下一个索引,例如“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)
}
理想情况下,我想要一个只需要插入网站链接并获得结果的功能。这是自动找到的信息的索引。