我正在努力以表格格式将特定api URL的JSON结果获取到Google表格中。
我已使用以下链接中的代码通过添加脚本将JSON数据导入Google Spreadsheets。 https://gist.github.com/paulgambill/cacd19da95a1421d3164
但我仍然无法正确获取数据。我在JSON输出下面列出。有人可以帮我如何以表格格式在Google表格中正确显示它吗?
我使用的公式是
=importjson(B1,"","noInherit, noTruncate")
,单元格B1的api网址中也包含一个?apikey。
谢谢
第一个链接
{
"squad":[
{
"name":"England",
"players":[
{
"pid":24598,
"name":"Eoin Morgan"
},
{
"pid":351588,
"name":"Mark Wood"
}
]
},
{
"name":"Pakistan",
"players":[
{
"pid":227760,
"name":"Sarfraz Ahmed"
},
{
"pid":43685,
"name":"Yasir Shah"
}
]
}
],
"cache":true,
"v":"1",
"ttl":7,
"provider":{
"source":"Various",
"url":"https://cricapi.com/",
"pubDate":"2019-05-15T16:12:58.268Z"
},
"creditsLeft":234
}
第二链接
{
"dateTimeGMT":"2019-05-14T12:00:00.000Z",
"data":{
"fielding":[
{
"title":"Fielding for Pakistan Innings",
"scores":[
{
"name":"CR Woakes",
"runout":0,
"stumped":0,
"bowled":2,
"lbw":0,
"catch":1,
"pid":"247235"
},
{
"name":"TK Curran",
"runout":1,
"stumped":0,
"bowled":1,
"lbw":1,
"catch":0,
"pid":"550235"
}
]
},
{
"title":"Fielding for England Innings",
"scores":[
{
"name":"MM Ali",
"runout":0,
"stumped":0,
"bowled":0,
"lbw":0,
"catch":1,
"pid":"8917"
},
{
"name":"Shaheen Shah Afridi",
"runout":1,
"stumped":0,
"bowled":0,
"lbw":0,
"catch":0,
"pid":"1072470"
}
]
}
],
"bowling":[
{
"scores":[
{
"6s":1,
"4s":9,
"0s":28,
"Econ":"6.70",
"W":"4",
"R":"67",
"M":"0",
"O":"10",
"bowler":"CR Woakes",
"pid":"247235"
},
{
"6s":0,
"4s":1,
"0s":1,
"Econ":"9.00",
"W":"0",
"R":"9",
"M":"0",
"O":"1",
"bowler":"JL Denly",
"pid":"12454"
}
],
"title":"Bowling To Pakistan Innings"
},
{
"scores":[
{
"6s":3,
"4s":5,
"0s":24,
"Econ":"7.12",
"W":"1",
"R":"57",
"M":"0",
"O":"8",
"bowler":"Junaid Khan",
"pid":"259551"
},
{
"6s":0,
"4s":1,
"0s":0,
"Econ":"10.80",
"W":"0",
"R":"9",
"M":"0",
"O":"0.5",
"bowler":"Asif Ali",
"pid":"494230"
}
],
"title":"Bowling To England Innings"
}
],
"batting":[
{
"scores":[
{
"dismissal-by":{
"name":"TK Curran",
"pid":"550235"
},
"dismissal":"bowled",
"SR":115,
"6s":1,
"4s":16,
"B":131,
"R":151,
"dismissal-info":" b Curran",
"batsman":"Imam-ul-Haq",
"pid":"568276"
},
{
"dismissal":"not out",
"SR":0,
"6s":0,
"4s":0,
"B":0,
"R":0,
"dismissal-info":"not out",
"batsman":"Junaid Khan",
"pid":"259551"
},
{
"SR":"",
"6s":"",
"4s":"",
"B":"",
"R":"",
"dismissal-info":"",
"detail":"10 (lb 1, w 9)",
"batsman":"Extras",
"pid":0
}
],
"title":"Pakistan Innings"
},
{
"scores":[
{
"dismissal-by":{
"name":"MM Ali",
"pid":"8917"
},
"dismissal":"catch",
"SR":138,
"6s":4,
"4s":8,
"B":55,
"R":76,
"dismissal-info":"c Asif Ali b Faheem Ashraf",
"batsman":"JJ Roy",
"pid":"298438"
},
{
"dismissal":"not out",
"SR":141,
"6s":1,
"4s":1,
"B":12,
"R":17,
"dismissal-info":"not out",
"batsman":"EJG Morgan (c)",
"pid":"24598"
},
{
"SR":"",
"6s":"",
"4s":"",
"B":"",
"R":"",
"dismissal-info":"",
"detail":"12 (lb 3, nb 1, w 8)",
"batsman":"Extras",
"pid":0
}
],
"title":"England Innings"
}
],
"team":[
{
"players":[
{
"name":"JJ Roy",
"pid":"298438"
},
{
"name":"LE Plunkett",
"pid":"19264"
}
],
"name":"England"
},
{
"players":[
{
"name":"Imam-ul-Haq",
"pid":"568276"
},
{
"name":"Junaid Khan",
"pid":"259551"
}
],
"name":"Pakistan"
}
],
"man-of-the-match":{
"name":"JM Bairstow",
"pid":"297433"
},
"toss_winner_team":"England",
"winner_team":"England",
"matchStarted":true
},
"type":"ODI",
"cache3":true,
"creditsLeft":234,
"v":"1",
"ttl":8,
"provider":{
"source":"Various",
"url":"https://cricapi.com/",
"pubDate":"2019-05-15T16:11:30.279Z"
}
}