Home > Mobile >  Finding ImportJSON Query Path in Google Sheets
Finding ImportJSON Query Path in Google Sheets

Time:11-10

Using Google Sheets with the custom enter image description here

Using the below formula, where cell A1 is the above URL, returns a #REF! error:

=ImportJSON(A1, "/data//highs", "noInherit, noTruncate")

I've also tried other variations of the /data//highs query (which would usually work with the IMPORTXML function) in the formula with the same result.

DESIRED OUTPUT

The query should result in displaying the records under "highs", i.e., both /data/nasdaq/highs and /data/nyse/highs.

The below image is the output for /data/nasdaq/highs. I'm looking to combine that query result with that for /data/nyse/highs in a single call.

enter image description here

CodePudding user response:

Using ImportJSON:

One option could be to just separate both queries by a comma:

=ImportJSON(A1, "/data/nasdaq/highs,/data/nyse/highs", "noInherit, noTruncate")

This has several potential downsides, though: it won't automatically detect any additional ticket that has highs, but just nasdaq and nyse. If you wanted others, you'd have to edit your query.

Also, it will return nasdaq and nyse values in multiple columns, which I assume is not what you want.

Writing an alternative function:

Alternatively, since importJson cannot handle queries like //data/*/highs, I'd suggest writing a different enter image description here

  • Related