10/22/2023 0 Comments Import json into excelIn these cases it may not make sense to flatten the JSON. These can become quite complex with embedded data-within-data. At one bank I did some work for, financial products were represented in JSON. However, JSON can also represent far more complex data structures. It’s a two-dimensional structure and very easy to ‘flatten’. The JSON example in this article is very simple. Now whether it’s a good approach to flatten JSON like that tool does, has a very succinct answer: it depends. IN a sense, that’s sort of what we’re doing with the VBA code example in this article. The tool you provided the link for looks quite interesting. I’ll probably update this post with your and his feedback as it’s been really helpful to know what things can go wrong. Let me know how you go with those 2 checks.Īnother commenter, Phil experienced issues as he’s running a 64-bit edition of Excel (I’m running a 32-bit edition). If you step through the code, you should be able to view the contents of the items object. If it looks okay, then check what’s in the “items” object. If there is no JSON or it looks corrupted, if you’re running this code from work (corporate) environment, make sure there are no firewall issues stopping you from retrieving data from the web. This will spit out the raw JSON to the Immediate window so you can check it. Try adding the following line right after the script.Eval line above: The first thing to check is the raw JSON that has been returned from the website. This takes the raw JSON which was returned from the website and turns it into an “object” which can be iterated through like a dictionary or collection. Set items = script.Eval(“(” & response & “)”) Just prior to calling the GetItemCount helper function, there’s this line:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |