如何在谷歌电子表格中获得台湾证券交易所指数

时间:2014-02-14 02:20:57

标签: google-sheets google-spreadsheet-api google-finance google-finance-api

如何在谷歌电子表格中获得台湾证券交易所指数? 该索引确实存在于https://www.google.com/finance?q=TPE%3ATAIEX

下的Google财经中

我尝试了以下公式,但所有这些都失败了。

=GoogleFinance("TPE:TAIEX"; "price")
=GoogleFinance("TPE.TAIEX"; "price")
=GoogleFinance("TAIEX.TW"; "price")
=GoogleFinance("TAIEX:TPE"; "price")
=GoogleFinance("TAIEX.TPE"; "price")
=GoogleFinance("TPE%3ATAIEX"; "price")

2 个答案:

答案 0 :(得分:2)

=GoogleFinance("TWII"; "price")

答案 1 :(得分:1)

我可以建议你解决2个问题:

appscript技巧:
构建一个谷歌应用程序脚本,以从您喜欢的网站检索数据。 Bellow以及网站http://www.bloomberg.com/quote/TWSE:IND的例子。我不知道这个例子是否足以满足你的需要,所以你可以很容易地改变剧本,改变正则表达式和网站网址。
请注意,因为我是法国人,我需要更改“,”为“。”这可能不是你需要的。

function twn(){
var feed = UrlFetchApp.fetch("http://www.bloomberg.com/quote/TWSE:IND");  // URL of your favorite site
  var taux = feed.getContentText().match(/meta itemprop\="price" content\="[0-9,\.]*"/); // looking for a regexp in the retrieved page
  taux = taux[0].slice(31,taux[0].length-1); // cleaning around what you retrieved
  taux = taux.replace(",",""); // french trick
  taux = taux.replace(".",","); // french trick
  Logger.log("taux: "+taux); // a little log to check Is I'm not doing anything bad
  return(taux); // result displayed in your spreadsheet when you call function twn()
}

电子表格技巧:

电子表格中的

使用公式:
=mid(REGEXEXTRACT(concatenate(Importdata("http://www.bloomberg.com/quote/TWSE:IND"));"itemprop=""price"" content=""[0-9,\.]*");27;10)