ImportJSON
ImportJSON copied to clipboard
Reordering columns via allHeaders is broken
Let's say I have a JSON response that will create 26 columns worth of data, but I just want the first 3 in reverse order.
=importJson("example.com/json_abcs", "/c, /b, /a") isn't enough. It will give me the 3 columns but in the order as given in the JSON response. I will have to include allHeaders to create the following...
`=importJson("example.com/json_abcs", "/c, /b, /a", "allHeaders")`
However, this no longer works.
There are some bad hacks that involve duplicate data, multiple calls, etc. Bu the fact of the matter is that the ordering of headers is broken.
I just tried allHeaders and it seems to be working for me. I'm not sure if it was broken before and fixed, but it's working now. Make sure to put the JSON objects in the order you want them to appear (the columns), and then pass the allHeaders parameter at the end. For example, something like: =ImportJSON("https://domain.com/file.json", "/date,/name,/amount", "allHeaders,noInherit,noTruncate")
Also, make sure you have the latest version of the script running. You can get it here: https://github.com/bradjasper/ImportJSON/blob/master/ImportJSON.gs