bradjasper / ImportJSON

Import JSON into Google Sheets, this library adds various ImportJSON functions to your spreadsheet

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

extracting only specific column from the ImportJSON request response?

keanumelody opened this issue · comments

Hello
Great code, thank you. I need the result to an API call to be only specific column or specific columns and not all the columns which the URL returns. How can I do that? I have tried to add ,"/column" to the end of the formula but that does not help, returns a parse error. My JSON example response is below, what should I do to only get back name of the teams (Home and Away) and the scores in first half?

{
"get": "fixtures",
"parameters": {
"live": "all"
},
"errors": [],
"results": 4,
"paging": {
"current": 1,
"total": 1
},
"response": [
{
"fixture": {
"id": 239625,
"referee": null,
"timezone": "UTC",
"date": "2020-02-06T14:00:00+00:00",
"timestamp": 1580997600,
"periods": {
"first": 1580997600,
"second": null
},
"venue": {
"id": 1887,
"name": "Stade Municipal",
"city": "Oued Zem"
},
"status": {
"long": "Halftime",
"short": "HT",
"elapsed": 45
}
},
"league": {
"id": 200,
"name": "Botola Pro",
"country": "Morocco",
"season": 2019,
"round": "Regular Season - 14"
},
"teams": {
"home": {
"id": 967,
"name": "Rapide Oued ZEM",
"winner": false
},
"away": {
"id": 968,
"name": "Wydad AC",
"winner": true
}
},
"goals": {
"home": 0,
"away": 1
},
"score": {
"halftime": {
"home": 0,
"away": 1
},
"fulltime": {
"home": null,
"away": null
},
"extratime": {
"home": null,
"away": null
},
"penalty": {
"home": null,
"away": null
}
}
}
]
}

Anybody? :)

I used Google Sheets filters...

=QUERY(ImportJSON("API_URL"),"select Col1")

Col1 needs to be the column you want. i.e. Column1 = Col1, Column2 = Col2, etc...