3

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

我试过以下公式,但都失败了。

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

[从文档](https://support.google.com/drive/answer/3093281):“GOOGLEFINANCE只提供英文版本,不支持大多数国际交流”。我猜这就是问题所在。 – stoneage

回答

2
=GoogleFinance("TWII"; "price") 
1

我可以建议你2解决方法:

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

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)