I am using a Query combined with ImportJson function to call an api and retrieve it’s data in Google Sheets. Currently I have been using the Select Col(x) method but that doesn’t work when the api frequently changes around the column order.
=QUERY(IMPORTJSONBasicAuth(URL;;;;"noInherit,noTruncate");"select Col3,Col4,Col6")
I want the formula to retrieve the data based on specified column headers.
Headers examples:
- Content Rank
- Content ID
- Content Points
I have tried some workarounds but could not manage to make this happen unfortunately.
Could anyone help me out?
Much appreciated!
>Solution :
You may try:
=let(Σ;IMPORTJSONBasicAuth(URL;;;;"noInherit,noTruncate");
choosecols(Σ;index(xmatch({"Content Rank"\"Content ID"\"Content Points"};chooserows(Σ;1)))))
