function stockPrice(ticker) {
var url = "https://api.iextrading.com/1.0/stock/" + ticker + "/price";
return fetch(url)
.then(function(response) {
return response.text();
})
.then(function(text) {
return parseFloat(text);
});
// Note: in case of an error, the returned rejected Promise
// will be bubbled up to Excel to indicate an error.
}
CustomFunctionMappings.STOCKPRICE = stockPrice;
是否有可能通过在一个请求中为它提供每一行的所有参数来批处理 Web 服务请求并仅调用一次,从而使用从服务返回的相应响应一次更新所有行,而不是调用 Web 服务每一行?这将有助于在大量行的情况下。