Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Calling specific columns by header name in Query with ImportJson function in sheets

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:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

  • 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)))))

enter image description here

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading