【发布时间】:2020-03-26 18:04:54
【问题描述】:
在 Google 表格中,我想获取一些股市信息。我创建了这个函数:
function getPrice(sTicker, iColumn) {
var iRow = 1;
var response = ImportJSON("https://financialmodelingprep.com/api/v3/company/profile/" + sTicker);
return response[iRow][1].toString().replace(".", ",");
}
我什至没有使用 iColumn,但在我的 Google 表格中,使用“=getPrice(B6,1)”时出现错误。
如果我在调用函数时删除第二个参数并使用 '=getPrice(B6)',它会起作用。
谁能解释我做错了什么?
【问题讨论】:
-
你的函数内部没有使用 iColumn 变量,为什么需要包含它?
标签: javascript google-apps-script google-sheets custom-function