5

In Google Sheets

=ArrayFormula(row(1:100))  

fills 100 columns with numbers 1-100.

=ImportJSON("http://www.domain.com/sample1.json", "")

inserts my JSON data keys and values into corresponding rows.

How can I set this up so that for each column, I change the number for the JSON file?

I tried combining these two functions but it just errors. =ArrayFormula(ImportJSON("http://www.domain.com/sample&row(1:100)&.json", ""))

Now this works:

=ArrayFormula(row(1:100)&ImportJSON("http://www.domain.com/sample1.json", ""))

but it's not putting the number in the desired spot. It's just adding it before each cell.

2

I think you forgot to separate the first part of the url, the formula and the second part with quotations, deeming them as strings, note there are quotes around "http://www.domain.com/sample" then a function insertion then the rest of the string ".json"

=arrayformula("http://www.domain.com/sample"&row(1:100)&".json")
  • You got me thinking on the right track. It does still pose a problem when trying to use the ImportJSON function (which I found on GitHub) within the ArrayFormula function. I tried a few different things and finally came up with this: =ImportJSON("http://www.domain.com/sample"&row()-1&".json") This uses the number of the row to fill in the information in the ImportJSON function. – BarryMode Dec 18 '15 at 19:16
  • Good I'm glad you came to that, that was originally what I had done, I just modified my answer to support your range of rows :) but I was having an issue with the arrayformula for the import part as well – Aurielle Perlmann Dec 18 '15 at 19:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.