如何在拖动单元格时增加函数参数中的数字
How to increment number in function parameter as we drag the cells
我有一个自定义函数(在下面找到)将 jason 数据解析为 googlesheets。使用函数我正在使用以下参数检索值。
=IMPORTJSON("https://mirko.com/api/v3/financials/income-statement/"&C4&"","financials/0/date")
我希望 "financials/0/date" 中的值像这样递增 1,2,3,.....x。我怎么可能做到。
/**
* Imports JSON data to your spreadsheet Ex: IMPORTJSON("http://myapisite.com","city/population")
* @param url URL of your JSON data as string
* @param xpath simplified xpath as string
* @customfunction
*/
function IMPORTJSON(url,xpath){
try{
// /rates/EUR
var res = UrlFetchApp.fetch(url);
var content = res.getContentText();
var json = JSON.parse(content);
var patharray = xpath.split("/");
//Logger.log(patharray);
for(var i=0;i<patharray.length;i++){
json = json[patharray[i]];
}
//Logger.log(typeof(json));
if(typeof(json) === "undefined"){
return "Node Not Available";
} else if(typeof(json) === "object"){
var tempArr = [];
for(var obj in json){
tempArr.push([obj,json[obj]]);
}
return tempArr;
} else if(typeof(json) !== "object") {
return json;
}
}
catch(err){
return "Error getting data";
}
}
假设你在第 4 行使用这个公式,你可以试试
=IMPORTJSON("https://mirko.com/api/v3/financials/income-statement/"&C4,"financials/"&row(C4)-4&"/date")
看看是否有帮助?
尝试:
=ARRAYFORMULA(IMPORTJSON("https://mirko.com/api/v3/financials/income-statement/"&C4:C,
"financials/0/date"))
或:
=ARRAYFORMULA(IMPORTJSON("https://mirko.com/api/v3/financials/income-statement/"&C4:C,
"financials/"&ROW(C4:C)-4&"/date"))
我有一个自定义函数(在下面找到)将 jason 数据解析为 googlesheets。使用函数我正在使用以下参数检索值。
=IMPORTJSON("https://mirko.com/api/v3/financials/income-statement/"&C4&"","financials/0/date")
我希望 "financials/0/date" 中的值像这样递增 1,2,3,.....x。我怎么可能做到。
/**
* Imports JSON data to your spreadsheet Ex: IMPORTJSON("http://myapisite.com","city/population")
* @param url URL of your JSON data as string
* @param xpath simplified xpath as string
* @customfunction
*/
function IMPORTJSON(url,xpath){
try{
// /rates/EUR
var res = UrlFetchApp.fetch(url);
var content = res.getContentText();
var json = JSON.parse(content);
var patharray = xpath.split("/");
//Logger.log(patharray);
for(var i=0;i<patharray.length;i++){
json = json[patharray[i]];
}
//Logger.log(typeof(json));
if(typeof(json) === "undefined"){
return "Node Not Available";
} else if(typeof(json) === "object"){
var tempArr = [];
for(var obj in json){
tempArr.push([obj,json[obj]]);
}
return tempArr;
} else if(typeof(json) !== "object") {
return json;
}
}
catch(err){
return "Error getting data";
}
}
假设你在第 4 行使用这个公式,你可以试试
=IMPORTJSON("https://mirko.com/api/v3/financials/income-statement/"&C4,"financials/"&row(C4)-4&"/date")
看看是否有帮助?
尝试:
=ARRAYFORMULA(IMPORTJSON("https://mirko.com/api/v3/financials/income-statement/"&C4:C,
"financials/0/date"))
或:
=ARRAYFORMULA(IMPORTJSON("https://mirko.com/api/v3/financials/income-statement/"&C4:C,
"financials/"&ROW(C4:C)-4&"/date"))