Ms excel and json

To Parse Custom JSON data is to split out its name/value pairs into a more readable useable format.

Excel is a powerful tool that allows you to connect to JSON data and read it.  However sometimes this data might require a little manipulation to be fully understood and analysed in Excel. 

In this article you will learn

  • What is JSON Data
  • To Connect to JSON data from Excel
  • How to Parse simple JSON Data using Excels Power Query
  • To Parse complex JSON Data using Excels Power Query

This article contains data tables to download so you can practice along and master the art of parsing custom JSON data using Excel.  We are also powered with STEEM so you can earn while you learn 😊.  If you are not familiar with Excel Power Tools you can find out about them here.

What is JSON Data?

JSON data is a way of representing objects or arrays.  It is easy to read, and it is easy to parse, even with Excel.  Many API calls will return JSON format and many web apps use JSON which easily moves information around the internet.

The syntax for JSON comes from JavaScript and can be summarized as follows:

  • Data is shown in name/value pairs separated by : For example “name” : ”paulag”
  • Data is separated by commas. For Example “name” : ”paulag” , “Sex” : “Female”
  • Curly brackets represent an object. An object being a name/value pair separated by a comma. For Example {“name” : ”paulag” , “Sex” : “Female”}
  • Square brackets hold arrays and contains a list of values separated by a comma.

Look at the sample JSON in the image below

How to Parse Custom JSON Data using Excel

{“total_population”: This shows the first object, which is a name/value pair.  The name of the object is total_population

[{“date”: “2019-01-02”, “population”: 7638335801}, {“date”: “2019-01-03”, “population”: 7638557789}]}  This is the value for the total population. The [ represents an array.  This array contains two objects. The objects are defined within the curly brackets and separated with a comma. Each object contains 2 lots of data (name/value pair) also separated with a comma.  The data, shown in the name/value pairs, in this example is date and population.

Here is one you can look at yourself. https://api.coinmarketcap.com/v1/ticker/bitcoin/

If you enter this to your browser, you will get something like the below:

excel JSON

Let’s take a look at that image in more detail.

Connecting to JSON data from Excel

In Excels Data ribbon, under GET and Transform Data, we have the option of connecting to data of multiple sources and multiple types. 

If we select Get data from file, we will then have the option to get data from a JSON file. 

In this example we have URL API endpoint https://api.coinmarketcap.com/v1/ticker/bitcoin/.  Therefore, from the Data Ribbon we can select, Get data from Web.  This will open a dialogue box in which you place the URL.

Next, Power query will then open.  Power query is a magic excel tool that will allow you transform data that you connect to into a usable format.

The JSON data will appear as a list of records Power Query. For excel to read this, we must convert a list to a table. Select ‘to table’ from the available option.

Next, Power query will create a table and you will see this step appear on the right of the power query window under applied steps. 

This new table contains a record. We must expand this record to get the value pairs. As this record only has 1 row, we would expect this to expand across the columns.  To do this, right click on the arrows in the column header.

This will reveal the names of the value pairs.  By selecting ok a new column will be set up in the table.  The name will be in the header and the value in the row.  

Further transformations

If we wanted this data going down the row, we could Unpivot the columns.  By selecting the id column.  Then from the Transform ribbon select the dropdown for unpivot columns and select unpivot other columns. 

When working with Power Query, it’s important to make sure you have the correct data types set.  To work with this data, we must now move to from Power Query to Excel.  If we select File, and then select Close and load, this will load the data as a table in Excel.  Or, if we select or Close and Load to, the data will be loaded into a Power Pivot Model.  

How to Parse JSON Data in Excel

Very often when you access JSON data with Excel it appears in 1 column.  This can happen for many reasons and is often the design of a database.

Look at the image below.  We can see the json_metadata field is still in its JSON syntax

How to Parse Custom JSON Data using Excel

When we encounter data like this, we can easily parse the column into its components.  From the image below we see we have 4 components. We have An Array, an Object, the data, and one of the data fields contains an array.

How to Parse Custom JSON Data using Excel

STEP by STEP

Download this file.  It contains a table as shown below.  (do not copy and paste the table as the JSON field will not be recognised.) 

tx_id

tid

json_metadata

timestamp

647524676

follow

[“follow”,{“follower”:”mervin-gil”,”following”:”jarvie”,”what”:[“blog”]}]

43466.89097

647524682

follow

[“follow”,{“follower”:”steliosfan”,”following”:”michealb”,”what”:[“blog”]}]

43466.89097

647524833

follow

[“follow”,{“follower”:”eugenezh”,”following”:”zentricbau”,”what”:[“blog”]}]

43466.89097

647524855

follow

[“follow”,{“follower”:”bitcoinportugal”,”following”:”manuellevi”,”what”:[]}]

43466.89097

647525074

follow

[“follow”,{“follower”:”eugenezh”,”following”:”adriellute”,”what”:[“blog”]}]

43466.89167

647525089

follow

[“follow”,{“follower”:”bigbigtoe”,”following”:”hoxly”,”what”:[“blog”]}]

43466.89167

647525121

follow

[“follow”,{“follower”:”mervin-gil”,”following”:”loveon”,”what”:[“blog”]}]

43466.89167

647525159

follow

[“follow”,{“follower”:”mervin-gil”,”following”:”pechichemena”,”what”:[“blog”]}]

43466.89167

647525233

follow

[“follow”,{“follower”:”imealien”,”following”:”pataty69″,”what”:[“blog”]}]

43466.89167

647525652

follow

[“follow”,{“follower”:”mervin-gil”,”following”:”kamile”,”what”:[“blog”]}]

43466.89236

647525818

follow

[“follow”,{“follower”:”bitcoinportugal”,”following”:”drmake”,”what”:[“blog”]}]

43466.89236

647525886

follow

[“follow”,{“follower”:”mervin-gil”,”following”:”bradfordtennyson”,”what”:[“blog”]}]

43466.89236

647525980

follow

[“follow”,{“follower”:”a0i”,”following”:”shoemanchu”,”what”:[“blog”]}]

43466.89236

647526007

follow

[“follow”,{“follower”:”voteme”,”following”:”kostyantin”,”what”:[“blog”]}]

43466.89236

648215552

follow

[“follow”,{“follower”:”ansie”,”following”:”hoxly”,”what”:[“blog”]}]

43467.75833

648215582

follow

[“follow”,{“follower”:”ashokcan143″,”following”:”abcor”,”what”:[]}]

43467.75833

648215691

follow

[“follow”,{“follower”:”ashokcan143″,”following”:”abasinkanga”,”what”:[]}]

43467.75903

648215820

follow

[“follow”,{“follower”:”nongvo.piy”,”following”:”acidyo”,”what”:[]}]

43467.75903

648215859

follow

[“follow”,{“follower”:”grid9games”,”following”:”yeninsfer”,”what”:[“blog”]}]

43467.75903

648215945

follow

[“follow”,{“follower”:”nongvo.piy”,”following”:”acidyo”,”what”:[“blog”]}]

43467.75903

Click on any of the cells that contain the data and from the Data Ribbon select FROM Table/Range

How to Parse Custom JSON Data using Excel

If your data is not in table format, Excel will then prompt you to create a table.  Select the cells the contain the data and tick the box to say that your table has headers.

How to Parse Custom JSON Data using Excel

Power Query editor window will open. On the canvas you can see your data and, on the right, you can see any transformation steps that have taken place.

How to Parse Custom JSON Data using Excel

To parse the json column, first select the column, then on the Transform Ribbon select Parse and select JSON

How to Parse Custom JSON Data using Excel

Power query will recognise the first [ and create a list format.  Next, we need to expand this list to new rows.  To do this click on the arrows on the top of the column and select Expand to New Rows.

How to Parse Custom JSON Data using Excel

What is returned is two lines for each tx-id.  The json column now has a row for the name of the array, which is follow, and a record.  The record will contain the data.

How to Parse Custom JSON Data using Excel

As we do not need the name of the array, we can use the filter to remove all the follow rows

How to Parse Custom JSON Data using Excel

We are now left with the records. We can expand this record, by pressing the arrow on the column.  From here we see we have the names of 3 data fields, Follower, Following and What

How to Parse Custom JSON Data using Excel

When we select OK, we get a new column in our data table for each data field.

However, the field named what contains an array, which is again shown as a list (or array) which needs to be expanded

How to Parse Custom JSON Data using Excel

Once we expand this, we are at the end of the JSON data and have extracted the relevant columns.  You can now use this data for further analysis in Excel or Power Pivot.  To load it back to excel, select File and Close & Load.

How to Parse Custom JSON Data using Excel

More complex JSON data extractions in Excel

So far, we have looked at getting JSON data into Power Query using an Excel table and directly from a URL.  There are other ways you can connect to JSON data including connecting directly to a JSON file.  Connecting is the easy part.  Things get more complicated when you have JSON columns where the strings are different in each row.  One might start with an array and so return a list, but some might start with an object and return a record.  

In Power Query lists are expanded to new rows in the table and records are expanded to new columns. Parsing custom JSON data in Excel can require some thinking.

JSON (Javascript Object Notation) is the most used data exchange format nowadays. Microsoft Excel doesn’t have built-in support for importing JSON to excel or exporting excel data to JSON.

VBA-JSON is an excellent library for parsing JSON in VBA. Lets see how to handle JSON in Excel VBA. If you’re new to JSON then read JSON tutorial for beginners

Prerequisites

  1. Save your excel file as Macro-Enabled workbook (Refer screen shot below)
  2. Enable macros if they are not already enabled. You can enable it by cliking on file > options > Trust Center > Trust Center Settings > Enable all macros

Save as xlsm
Enable excel macros

Getting Started

  1. Download VBA JSON latest version from here
  2. Extract it, open VBA code editor in excel (Alt + F11) and import the library as shown in the gif below.
  3. Add a reference to Microsoft scripting runtime. (Tools > references > select)
  4. Add a reference to MSXML (Tools > references)
    Select appropriate version based on your PC :
    1. Microsoft XML, v 3.0.
    2. Microsoft XML, v 4.0 (if you have installed MSXML 4.0 separately).
    3. Microsoft XML, v 5.0 (if you have installed Office 2003 – 2007 which provides MSXML 5.0 for Microsoft Office Applications).
    4. Microsoft XML, v 6.0 for latest versions of MS Office.

excel to json
Add reference microsoft xml and scripting runtime excel

Import JSON to Excel

This library provides a simple method ParseJson to parse JSON string into a dictionary object which can be used to extract data. Let’s see an example.

I’m using fake data from http://jsonplaceholder.typicode.com/ which is an API service with fake Json data.

We’ll be pulling user data from http://jsonplaceholder.typicode.com/users by making a GET request which responds with Json data.

json sample data - json to excel

Read more about GET requests in VBA here

Next, we’ll parse that Json and import it to excel. Code for importing data looks like this :

Public Sub exceljson()
Dim http As Object, JSON As Object, i As Integer
Set http = CreateObject("MSXML2.XMLHTTP")
http.Open "GET", "http://jsonplaceholder.typicode.com/users", False
http.Send
Set JSON = ParseJson(http.responseText)
i = 2
For Each Item In JSON
Sheets(1).Cells(i, 1).Value = Item("id")
Sheets(1).Cells(i, 2).Value = Item("name")
Sheets(1).Cells(i, 3).Value = Item("username")
Sheets(1).Cells(i, 4).Value = Item("email")
Sheets(1).Cells(i, 5).Value = Item("address")("city")
Sheets(1).Cells(i, 6).Value = Item("phone")
Sheets(1).Cells(i, 7).Value = Item("website")
Sheets(1).Cells(i, 8).Value = Item("company")("name")
i = i + 1
Next
MsgBox ("complete")
End Sub

Code explanation

  1. First, define JSON as an object and make a GET request to JSON API
  2. JSON data received in the response is parsed by passing it into ParseJson method.
  3. parsed data is converted into a collection of dictionaries.
  4. Loop through the collection to get each user’s details and set its values to the first sheet.

Running above code looks like gif below.

import json demo - json to excel

Reading JSON from a file

In the same example above, If you want to read JSON data from a local file then you can use FileSystemObject to read all text in the file and then pass it to ParseJson method.

Dim FSO As New FileSystemObject
Dim JsonTS As TextStream
Set JsonTS = FSO.OpenTextFile("example.json", ForReading)
JsonText = JsonTS.ReadAll
JsonTS.Close
Set JSON = ParseJson(JsonText)

Export Excel to Json

VBA-JSON provides another method ConvertToJson which can be used to convert excel data into JSON. Here’s an example.

Sample data with Name, Phone and Email is present in second sheet. Let’s convert it into JSON

Code for this looks like :

Public Sub exceltojson()
Dim rng As Range, items As New Collection, myitem As New Dictionary, i As Integer, cell As Variant
set rng = Range("A2:A3")
'Set rng = Range(Sheets(2).Range("A2"), Sheets(2).Range("A2").End(xlDown)) use this for dynamic range
i = 0
For Each cell In rng
Debug.Print (cell.Value)
myitem("name") = cell.Value
myitem("email") = cell.Offset(0, 1).Value
myitem("phone") = cell.Offset(0, 2).Value
items.Add myitem
Set myitem = Nothing
i = i + 1
Next
Sheets(2).Range("A4").Value = ConvertToJson(items, Whitespace:=2)
End Sub

Code Explanation

  1. First, define rng as range and set it to data range.
  2. ConvertToJson method takes a dictionary collection or array as parameter. So we should pass our data as a collection.
  3. A Dictionary is an object with keys and values just like JSON but doesn’t support multiple items like arrays or collections, so we create a dictionary for each item and push it into an array or a collection.
  4. Define a dictionary and a collection, loop through the range and set each row’s data into myitem
  5. Push myitem into collection and set it to nothing, because we are using the same dictionary to add next row’s data and push it to collection again.

Finally pass items collection to ConvertToJson method which returns a JSON string.

Running above code looks like gif below

export excel to json

Export Excel to JSON file

In the same example above, If you want to export excel data to JSON file then It can be done by opening a file for output by specifying the path of the file and printing data in it. Sample code below, Running this would save a JSON file in the current workbook’s folder.

Public Sub exceltojsonfile()
Dim rng As Range, items As New Collection, myitem As New Dictionary, i As Integer, cell As Variant, myfile As String
Set rng = Range("A2:A3")
'Set rng = Range(Sheets(2).Range("A2"), Sheets(2).Range("A2").End(xlDown)) use this for dynamic range
i = 0
For Each cell In rng
Debug.Print (cell.Value)
myitem("name") = cell.Value
myitem("email") = cell.Offset(0, 1).Value
myitem("phone") = cell.Offset(0, 2).Value
items.Add myitem
Set myitem = Nothing
i = i + 1
Next
myfile = Application.ActiveWorkbook.Path & "data.json"
Open myfile For Output As #1
Print #1, ConvertToJson(items, Whitespace:=2)
Close #1
End Sub

Export Excel to Nested JSON

Above code can be modified a bit to get a nested JSON as output. Just add dictionary in another dictionary so that it creates a nested JSON. code looks like this :

Public Sub exceltonestedjson()
Dim rng As Range, items As New Collection, myitem As New Dictionary, subitem As New Dictionary, i As Integer, cell As Variant
Set rng = Range("A2:A3")
'Set rng = Range(Sheets(2).Range("A2"), Sheets(2).Range("A2").End(xlDown)) use this for dynamic range
i = 0
For Each cell In rng
Debug.Print (cell.Value)
myitem("name") = cell.Value
myitem("email") = cell.Offset(0, 1).Value
myitem("phone") = cell.Offset(0, 2).Value
subitem("country") = cell.Offset(0, 3).Value
myitem.Add "location", subitem
items.Add myitem
Set myitem = Nothing
Set subitem = Nothing
i = i + 1
Next
Sheets(2).Range("A4").Value = ConvertToJson(items, Whitespace:=2)
End Sub

Running above code looks like image below

export excel to nested json

Using array of strings and objects in JSON

One of our readers asked me how to use an array of strings and objects inside the JSON.

Here’s how to do it:

Public Sub exceltojson()
Dim rng As Range, items As New Collection, myitem As New Dictionary, i As Integer, cell As Variant, objectContainer As New Dictionary, arrayContainer As New Collection
Dim j As Integer
'Set rng = Range("A2:A3")
Set rng = Range(Sheets(1).Range("A2"), Sheets(1).Range("A2").End(xlDown)) 'use this for dynamic range
i = 0
For Each cell In rng
myitem("id") = cell.Value
myitem("name") = cell.Offset(0, 1).Value

'tags
tagsString = cell.Offset(0, 2).Value
tagsCollection = getCollectionFromString(tagsString)
myitem.Add "tags", tagsCollection

'ingredients
ingredientsString = cell.Offset(0, 3).Value
weightsString = cell.Offset(0, 4).Value
ingredientsUnit = cell.Offset(0, 5).Value
ingredientsCollection = getCollectionFromString(ingredientsString)
weightsCollection = getCollectionFromString(weightsString)

j = 0
For Each ingredient In ingredientsCollection
objectContainer("ingredientnaam") = ingredient
objectContainer("eenheid") = ingredientsUnit
objectContainer("hoeveelheid") = weightsCollection(j)
arrayContainer.Add objectContainer
Set objectContainer = Nothing
j = j + 1
Next
myitem.Add "ingredienten", arrayContainer

'Reset values
Set arrayContainer = Nothing
j = 0

items.Add myitem
Set myitem = Nothing
i = i + 1
Next
Sheets(1).Range("A6").Value = ConvertToJson(items, Whitespace:=2)
End Sub

Function getCollectionFromString(val)
getCollectionFromString = Split(val, ", ")
End Function

Running above code looks like image below
export excel to nested json

Wrapping up

Read official documentation of VBA-JSON here and use VBA-Dictionary for Mac Support.

Related articles :

  • Complete JSON tutorial here – JSON for beginners
  • Handling CSV in VBA

If you have any questions or feedback, comment below and please use CodingisLove Bin for sharing your code.

  • Author
  • Recent Posts

A CA- by education, self taught coder by passion, loves to explore new technologies and believes in learn by doing.

Table of contents

      • What is JSON?
      • What are the applications of JSON files?
      • What is Excel?
      • Applications of Excel
      • How to Import JSON file in EXCEL?
      • What is a JSON format?
      • How to view JSON files?
      • Free Excel Courses
      • Conclusion
      • FAQs
  • What is JSON?
  • What are the applications of JSON files?
  • What is Excel?
  • Applications of Excel
  • How to Import JSON file in EXCEL?
  • What is a JSON format?
  • How to view JSON files?
  • FAQs

What is JSON?

JSON is an abbreviation used for JavaScript Object Notation which is a file format. JSON is used to store and exchange data over the network. The data from the server to the client can be shared through a JSON file. 

The JSON file is easy to share and analyze. The file extension of a JSON document is “.json”. It is a standard file format based on text and is mainly used for the transmission of data on websites and web applications. JSON syntax is just like the JavaScript Object syntax. It can be read and understood easily. It is most widely used among web applications because it is very lightweight to work with. The JSON files can be loaded easily and a non-technical person can also understand them quickly. 

The format that a JSON document is written as of key-value pair. JSON combined with Excel provides greater usability to import data. If you have a JSON file and you want to import it into Excel for better data analysis. Then it is possible to import the JSON file using Power Query. This article will look at this operation to import JSON to Excel. We’ll also see how you can use that imported data in Excel very efficiently. 

What are the applications of JSON files?

Here are some useful applications of JSON documents below:

  • JSON documents are mainly used to write programming code in programs that are specifically based on JavaScript, like Angular, Node, React, etc. 
  • JSON can adopt all programming languages, which is the main reason for its popularity. 
  • JSON files are useful when transferring data from the server to the client.
  • JSON is a lightweight document, and that’s the reason it is mostly used for web communications. 
  • The JSON documents are shared on the network in a structured way. 
  • Various applications allow importing data from JSON format through APIs, making the data import very easy. 
  • The JSON format is very useful for serialization and transmission of data over the network. 

What is Excel?

Excel is a software program developed by Microsoft. Excel is a very useful software to store data and is mainly used for the application of mathematical formulas on that data and calculation purposes. As data is very important for organizations, and that’s the reason Excel has become very productive for businesses. Excel is most widely used by businesses to analyze their data effectively. 

The extension of Excel is “.xlsx”. Excel also provides the creation of charts, graphs, and various visualizations that helps to understand the data. You can also customize the UI of Excel based on your preferences. 

You can even share an Excel file with collaborators to enable the updation of data from multiple users. This way, the Sales Managers take input from their team in a single Excel file. Excel also allows you to automate various data manipulation tasks through its inbuilt Visual Basic Application. You can use Visual Basic and write code to automate several tasks in Excel. This feature increases the productivity of using Excel. 

Excel also gives you a bunch of options to import your data through the Web or other file formats. You can also import your data from a JSON file. In this article, we’ll see how you can import JSON documents in Excel for better analysis of data. Also, while you’re at it, check out this excel course online free to learn more about excel.

Applications of Excel

  • Easy to Utilize Interface: The interface of MS Excel is easy to use, and anybody can understand the interface and usability of MS Excel quickly. 
  • Graphical Representation: It becomes very difficult to understand data in raw format. To solve this problem, Excel provides a graphical representation feature that you can use to visualize your data in a graphical format. This way, data can be analyzed very efficiently. 
  • Highly Supportive in Breaking Down Deals: Organizations use Microsoft Excel for their business needs. It helps businesses to examine the data of their sales and customers, which results in productive decision-making. 
  • Financial Modeling: The financial analysis of organizations is simplified by MS Excel, and the maintenance of financial records is made easy. It is very important to calculate the datasets in financial modeling, and Excel provides inbuilt formulas that are very useful for financial modeling. 
  • Accessibility of a Broad Scope of Functions: The functions in excel are very beneficial for evaluating equations and computation of mathematical formulas. The functions in excel can easily be modified according to the needs, and it also allows for the creation of new functions for the user. 
  • Future Development of Any Business: MS Excel is very important software that helps businesses to make future decisions. It helps in business analysis which helps organizations to find insights into the data. 

How to Import JSON file in EXCEL?

There are various versions of MS Excel in the market that comes under MS Office like Office 2007,  2010, 2013 and so on. So, we’ll look at all these versions on how to open JSON files in Excel. Unfortunately, Office 2007 doesn’t give an option to import JSON files. But the later version of Excel allows it.

How you can import JSON files in Office 2010 version? 

  • Open a New Excel Workbook and look for the Power Query tab. 
  • In the Power Query tab, go to Other sources and then click blank query. 
  • Now, go to the JSON file on your computer and copy the path of the file. 
  • In MS Excel, it will give you a blank space for your query, there you need to paste the path copied from the JSON file. 
  • Click OK and it will load the JSON file in Excel Power Query. Now you can manipulate the data of the JSON file. 

The version of MS Office introduced after Office 2010 was 2013. There were some changes in this version and let’s see how you can import your JSON files in Excel 2013.

  • Open a New Excel Workbook and find the Power Query tab. 
  • Go to Other sources and then choose blank query.
  • Go to Advanced editor in the Query Editor.
  • Enter the query as the path of your JSON file.

Now, the latest version of Excel comes under Office 2019. The below steps define how to open a JSON file in Excel. 

  • Go to the Data tab in an Excel Workbook.
  • Click on From File and then choose JSON.
  • Now, choose the JSON file from your system and select OPEN.
  • This will open the JSON file in Excel and now you can view the data. 

Opening JSON From the Internet in Excel

The latest version of Excel also supports importing the data from the web. You can also import the JSON file from the Internet or by using an API call. To import the JSON from the internet, you need to follow these steps:

  • Go to the Data tab in an Excel workbook.
  • Select From Web option under the “Get & Transform Data” ribbon.
  • After that an input box will appear in your window where you will have to enter the URL for the JSON file. 
  • Click OK and it will open the JSON file in Power Query first.
  • Then you need to transform the data into a table and also apply other transformations to your data. 
  • After that when you Close & Apply from the Power Query, it will open the transformed data in Excel. 

What is a JSON format?

JSON stands for JavaScript Object Notation which means the data in this file represents every information as an object. And the data stored in the JSON file is lightweight. The JSON format is used by JSON files as “.json”. It is very useful while communicating between the server and the client. The text format in the JSON file is completely language-independent. However, anyone can easily understand a JSON file because of its simplicity. The other programming languages such as Python, C, C++, and others can also use JSON files for various purposes. 

The JavaScript scripting language represents the data in a JSON file as a simple data structure by using associative arrays. These are called objects. By using these objects, the data can be differentiated easily. 

So the format JSON is used by the JSON files to organize the data. 

How to view JSON files?

As we know JSON is a document that contains data. So the JSON file is generally a text file just like other text files of Notepad or Notepad ++. The JSON file can be viewed in Notepad, Wordpad, or any other text editor. You can also view the JSON files in Python. To understand the data in a JSON file, it is best viewed in MS Excel. You can view the JSON document in an Excel workbook by importing the file available either on your system or on the internet. 

Free Excel Courses

  • Excel Tips and Tricks
  • Excel for Intermediate Level
  • VLOOKUP in Excel

Conclusion

JSON documents are very useful for transmitting the data from the server to the client. And Excel is used to store the data in a spreadsheet. Excel allow us to apply formulas and functions to that data. JSON document is best viewed in Excel in a table format and Excel presents the data in a clean format. So, it is very useful to import a JSON file in Excel. 

As we know, there are various versions of Excel available, but older versions of Excel don’t allow importing a JSON file. But, now you have the option to import any JSON document whether it is available locally on your machine or you can also import a JSON from the internet. 

In this article, we talked about how productivity increases when working with JSON and Excel together. You can use the steps described above to import a JSON file in MS Excel. Learn more Excel tricks with us today!

FAQs

How do I import a JSON file into Excel?

To import the JSON file to the latest version of Excel, you need to follow the below steps:
1. Open a new Excel workbook and go to the Data tab.
2. Select the option Get Data if you have the JSON file on your system and locate the path in the input field to get the JSON file. 
3. If you want to import a JSON file available on the internet, then you need to choose From Web option in the Data tab. 
4. After that you need to give the URL of the file and click OK. 
5. It will load the JSON file in Microsoft Power Query where you can transform the JSON file before it gets opened in MS Excel. 
6. After the transformation of your data in the JSON file, you need to close Power Query and it will load the data in the Excel workbook. 

How do I import JSON to Excel 2016?

To import the JSON file in MS Excel 2016 version, follow the steps given below:
1. Open a New Excel workbook and go to the Data tab.
2. Choose the Get Data option and Choose From JSON.
3. After that specify the path to the JSON file and click OK.
4. It will fetch the file and take you to the Power Query Editor. 
5. Now, you need to transform your JSON file to a table format. 
6. And then you need to click on Close and Apply which will open the table in Excel. 

How do I edit a JSON file in Excel?

To edit a JSON file in Excel, you need to import the file in Excel first. You can follow the steps discussed in this article to open a JSON file in Excel that will take you to Power Query Editor first. In the power query editor, you can edit the JSON file before importing it to Excel. 

How do I convert JSON to CSV?

When you import the JSON file in Excel, it will open the Power Query editor and then you need to transform the JSON file to a table format. After all the transformations are done, you need to close the Power Query that will open the JSON table in MS Excel. Then you can save the table in CSV format from excel. This way, you can convert a JSON document into CSV. 

How do I import data into Excel?

To import the data in Excel, go to the Data tab. There you will find various options to import the data such as From text/CSV, From Web, and Get Data. You can choose any of the options relevant to you and import the data in Excel. 

Can Excel read JSON?

Yes, you can import the JSON data in MS Excel. But first, you need to convert the data into a table format which will be done in Power Query when you import the data. This way Excel reads the data from the JSON document. 

How do I convert a JSON file to readable?

The steps below show how you can convert a JSON file to readable:
1. There is a tool named JSON to String that you can use to convert the JSON file. 
2. After opening the tool, you need to copy and paste the JSON Code to the text editor. 
3. You can also upload the JSON file to the tool that will convert it into readable. 
4. After that click on JSON to String button and then you will see the conversion is started. 
5. After successful conversion of JSON to readable, you can save and share the string data. 

Can Excel pull data from an API?

Yes, you can use API to import data to excel. You need to go to the Data tab in Excel and choose the Get Data option. There you will see From other Sources option. Then you need to choose From Web from that list. 
You will be asked for a URL where you can enter the API URL for the data you need to pull in Excel. This will import the data from the API call to Excel. 

How do I convert API data to Excel?

To access the API Data in Excel, follow the steps below:
1. Open MS Excel and go to the Data tab.
2. There you will see a bunch of options to get data, you need to choose From other sources drop-down list.
3. In the list, you will see an option From OData Data Feed. You will need to use this option.
4. After that you will be asked for a link URL or the path for the file. 
5. You can enter the URL of the results of the API service. 
6. Then if the API is public, you don’t need to enter the User Name and Password. But in the case of the private API call, you will have to enter the User Name and Password to connect to the API.
7. After successful connection to the API, you will be asked to fetch the data that you need in Excel.
8. Click Next and it will save the data connection and finish the dialogue box. 
9. Lastly you need to choose if you want to view the data in the existing worksheet or the new worksheet. There are other options too and you can choose any of them based on your needs. And it will download the data from the API to your excel. 
This way you can convert the API data to Excel. 

What is JSON?

JSON (JavaScript Object Notation) is a file format that is used for storing and exchanging data in the network. It is used to send data from server to client and client to server.  JSON is easy for machines to analyze and generate. The extension of JSON  is .json. 

JSON records are, in reality, straightforward to peruse on the off chance that you know the construction of a Javascript document. You can utilize a proofreader with explicit help for JSON to get the disentangling. For instance, if there is an extremely pleasant JavaScript addon for Notepad++ called JSTool, which incorporates a JSON watcher, it shows the decoded esteem strings so you can duplicate the string to another content record. 

Check Out upGrad’s Java Bootcamp

A commonplace JSON record is a word reference where every section has a string key, and each worth is a string, a number, or exacting like valid, bogus or invalid. The qualities are strings that are encoded by the shows of Javascript, which is practically equivalent to Java or C, implying that every typical character is composed with no guarantees and all extraordinary characters are encoded with an oblique punctuation line.

This is either followed by the scorch that is implied or by a hex number that addresses the ASCII or Unicode estimation of the singe. For example, on the off chance, you have French or Spanish scorches or dialects that are totally outside Latin letters in order like Russian or Chinese. 

JSON is JavaScript object documentation or a progression of JavaScript objects with recorded credits. These credits are what is recorded within each set of wavy sections and give data about the object. JSON records may contain numerous objects in each document. They might be the consequence of an information dump from a program that utilizes JSON documentation or methods by which a client can enter data into a data set. MongoDB, for instance, locally utilizes JSON to store information. 

A JSON document is a record that stores straightforward information constructions and objects in JavaScript Object Notation (JSON) design, which is a standard information trade design. It is principally utilized for sending information between a web application and a server. JSON documents are lightweight, text-based, comprehensible, and can be altered by using a content manager. 

Also, check out our free courses to get an edge over the competition.

Open the record in Notepad, save it as a .TXT document, and then import it into Excel.

The Structure of JSON is 

Filename = [{key: value}]

Example

JSONExample ={ “namelist” : [ {name:”mark”, age:18, location:” Mars”},

{name:Steve Rogers, age:118, location:”Moon”},

{name:”Tony”, age:48, location:”DC”},

{name:”Peter Parker”, age:18, location:”Queens”},

{name:”Thor”, age:18, location:”Ascord”} ],

“id”:1

}

Applications of JSON

  • JSON files are primarily used while writing programming code in Javascript-based programs like node, react, etc.
  • The JSON file is used for transmitting data in a structured way while transferring via a network.
  • Most of the time JSON is used to transfer data between server and client applications.
  • In the modern era, JSON overtakes XML in the maximum amount.
  • It can adapt to all programming languages.

upGrad’s Exclusive Software and Tech Webinar for you –

Check Out upGrad’s Advanced Certification in Cyber Security

SAAS Business – What is So Different?

What is Excel?

Excel is the name of a software program created by Microsoft and is known as Microsoft Excel. It uses a spreadsheet to store the data and numbers with the functions and formulas. The extension of the excel file is .xlsx. It is widely used in the business sector.

There are important things about excel that you can learn at upGrad. Excel is perhaps the most remarkable measurement software. It permits you to store the information in even arrangement, i.e., in lines and segment design. It additionally allows you to collaborate with your data differently. 

You can sort and channel the information utilizing probably the most powerful equations. The turntables one is the best component of Excel. You can use turntables to make another understanding by controlling the information. Excel has different highlights that can assist you with insights. There are different approaches to bringing in and sending out the information. You can likewise incorporate the data into the work process. 

Like no different insight software, Excel permits you to make the custom capacity utilizing its programming capacities. The basic role of Excel is to make records of information and to control the information according to the users’ requests. As referenced before, Excel permits you to utilize the outside information base to dissect and make reports, among other things. 

Currently, Excel offers the best graphical UI alongside the utilization of design instruments and representation strategies.

Source 

Applications of Excel

1. Easy to Utilize Interface

MS Excel has an easy-to-use interface that empowers the client to utilize the software effectively without battling an excessive amount to keep up any records. 

2. Graphical Representation

MS Excel empowers the client to graphically address the information entered. This component of excel helps break down the numbers easily when we manage an enormous amount of data. When handling a vast amount of data (extending to 1000 lines), graphical representation helps us assess the information quickly. 

3. Highly Supportive in Breaking Down Deals

Excel helps organizations break down deals and buys and appropriately assists them with examining their purchasing/selling choices. 

Our learners also read: Excel online course free!

4. Financial Modeling 

Quite possibly, the main benefit of Excel is that it simplifies the financial analysis of the organization. It helps with maintaining the financial records of the organization in an easily accessible format. Excel is often used to calculate or determine EBITDA, WACC, net sales, and net profits, among other things.

5. Accessibility of a Broad Scope of Functions

Excel has enormous scope for doing equations which assists us with computing the entirety, item, difference, and any arrangements of numbers. The user can call upon various functions to simplify the vast data at hand to offer an accurate deduction.

6. Future Development of Any Business 

Excel is a valuable instrument to break down different sorts of information. Organizations use Excel to get an accurate picture of their business development and get a realistic forecast of the coming years’ achievable growth. Excel helps organizations accomplishing a particular development rate by examining the progress of the business.

How to Open JSON file in EXCEL?

The methods of opening JSON files in Excel vary in different versions of Microsoft Excel. You can apply the following methods to open a JSON file depending on the versions of Excel you have:

Office 2007

In the 2007 version of Office, excel doesn’t have the option to open a JSON file in EXCEL.

Office 2010

  • After opening Excel, on the Power Query tab, click From Other Sources > Blank Query.
  • In the Query Editor, click Advanced Editor.
  • Input your query string as follows, replacing “C:UsersNameDesktopexample.json” with the path to your JSON file.

let

    Source = Json.Document(File.Contents(“C:UsersNameDesktopexample.json”)),

    #”Converted to Table” = Record.ToTable(Source)

in

    # “Converted to Table”

Office 2013

In the 2013 version of Office, excel doesn’t have the option to open a JSON file in EXCEL.

  • After opening Excel, on the Power Query tab, click From Other Sources > Blank Query.
  • In the Query Editor, click Advanced Editor.
  • Enter your query string as follows, replacing “C:Usersexample.json” with the path to your JSON file.

let

    Source = Json.Document(File.Contents(“C:Usersexample.json”)),

    #”Converted to Table” = Record.ToTable(Source)

in

    # “Converted to Table”

In Newer Version of Excel

  • Select Data > Get Data > From File > From JSON. The Import Data dialog box appears.
  • Search the JSON file, and then select Open.

Opening JSON From the Internet in Excel

The above methods are used for opening files stored in local storage. If you want to import JSON data from the internet or from an API call, you can do the following:

  • Go to Data Tab -> Transform data -> Click From Web. It will open a window or modal.

Source

  • Then, open the power query.

Source

  • Next, create a table for the JSON.

Source

  • By following the steps, you can open the JSON file in EXCEL.

Learn Software Courses online from the World’s top Universities. Earn Executive PG Programs, Advanced Certificate Programs, or Masters Programs to fast-track your career.

Conclusion

JSON (JavaScript Object Notation) is a file format that is used in storing data and exchanging data in the network. EXCEL uses a spreadsheet to store the data and numbers with functions and formulas. The steps for opening a JSON file in Excel differ in several versions of EXCEL. In the newer version, you can open a JSON file by selecting “Data” > Get Data > From File > From JSON. The Import Data dialogue box appears. Search the JSON file, and then select “Open.” You can check out Free online Excel courses offered by upGrad on Excel

If you’re interested to learn more about full-stack development, check out upGrad & IIIT-B’s Executive PG Program in Full-stack Software Development which is designed for working professionals and offers 500+ hours of rigorous training, 9+ projects and assignments, IIIT-B Alumni status, practical hands-on capstone projects & job assistance with top firms.

What is a json format?

JSON is a format of storing and exchanging data. It stands for JavaScript Object Notation. JSON is a lightweight data-interchange format. It is used primarily to transmit data between a server and web application, as an alternative to XML. It is a text format that is completely language independent but uses conventions that are familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript, Perl, Python, and many others. This data interchange format is simple, small, and language independent JSON was derived from the JavaScript scripting language for representing simple data structures and associative arrays, called objects. It has become quite popular for transporting data between the server and web application. It is considered as a lightweight or language independent alternative to XML and is used in numerous AJAX applications.

How to view json files?

JSON file is actually a text file, you can view it line by line with simple text editor like notepad, notepad++ or emacs and so on. If you want to view it in python, it’ll be better to install jq, in that case, you can view it in python like: jq ‘.result’. There are many available JSON libraries for almost every language. If you are interested in Java, you may want to check out GSON. If you want to use for Python, you can also use simplejson.

What are the applications of JSON files?

JSON files are files that store data in JavaScript Object Notation. This is a lightweight format for storing data which is easy for humans to read and write. One of the best features of JSON files is that they are readable by both machines and humans (unlike XML) and more importantly, they work well with JavaScript. JSON files are commonly used for data-driven web applications. In fact, you can even use them to make a web page dynamic. JavaScript has the ability to parse these files and that’s why JSON is one of the best ways to return data to a web page. You can store data in a well-organized and easily-readable format.

Want to share this article?

Land on Your Dream Job

JSON file is generally used to transmit the data on web applications. Most of the time, when the user transmits data on the web, they use JSON file format as it is light weighted. It means that the JSON file contains the data to be transmitted on web.

Besides this, you may also have files that you have created in JSON format. You get a requirement to read all the data at once. You can use MS Excel to open the JSON file for this type of purpose. You will find the JSON file saved with .json extension.

What is JSON and why to use it?

JSON is a standard text-based format that is used for transmitting data in web applications (e.g., client to server or server to client). JSON is based on the JavaScript object syntax. JSON is basically an easy-to-read data structure.

People use JSON because it is very lightweight to work with web applications. So, it can be loaded easily. JSON format is easy to read. Even a non-technical user can understand it. It is written in the form of key-value pair.

This is an example of a JSON file that how it looks like this:

How to open JSON files in Excel?

Why to open JSON file in Excel?

If the JSON file contains too much data, it is not easy to read that data at once or comparison of data too. In such scenarios, the JSON users can use MS Excel software for reading and comparing the data. Multiple lines of data can be easily analyzed in Excel.

Excel is a software in which you can insert the row data and read the large set of data that can be seen together. You can compare that too.

  • Use MS Excel because its interface is easy to use and utilize by even non-technical users.
  • MS Excel can be used as it allows graphical representation of data.
  • It is quite good for the financial modeling of data.

The topic discussed in this chapter

We are going to tell the different methods to open and convert the JSON file to Excel/format:

  1. Open JSON to Excel
  2. JSON to Excel conversion online

    1. JSON to CSV converter
    2. JSON to Excel converter
  3. Open JSON file in Excel from web

Open JSON into Excel

If you want to open or import the JSON file into Excel, you cannot directly insert into it. You have to follow a process to import the JSON file to Excel. In this chapter, we will instruct you to import the JSON file into Excel.

Excel offers a Power Query feature that can be used to import the JSON file into Excel. Power Query feature is now renamed as Get & Transform tool. It is available inside the Data tab.

Till Excel 2013 version, this feature was named Power Query. Later, it was renamed to Get & Transform in Excel 2016 and later versions. You do not need to write any VBA code script to get the data from the JSON file to Excel.

Example 1

We have created a JSON file containing three employees basic detail. Using this file, we will show you the steps to import the JSON file in Excel. Following the same steps, one can import the JSON data in Excel.

Below is the JSON file that we had created:

How to open JSON files in Excel?

Step 1: Now, open the Excel file, either existing or new. Then, navigate to the Data tab.

How to open JSON files in Excel?

Step 2: Click the New Query dropdown option and then From File and From Text.

New Query > From File > From Text

How to open JSON files in Excel?

In the newer version of Excel, you will explicitly find the From JSON option to import the JSON file. Currently, our MS Excel software has FROM Text option to import the JSON file.

Step 3: Now, navigate to the location where you have the JSON file and also change the file type from Text File to All Files.

How to open JSON files in Excel?

You can see that no JSON file is currently showing at this location.

Step 4: Now, select the JSON file and click the Import button to import the file data to the Excel sheet.

How to open JSON files in Excel?

Step 5: A Power Query editor will open where click the To Table option.

How to open JSON files in Excel?

Step 6: Now, click OK on this panel.

How to open JSON files in Excel?

Step 7: One more time, the Power Query editor will load on which click the icon in square box next to the column.

How to open JSON files in Excel?

Step 8: Here, you can also unselect the column, you do not want to include in the Excel table. We want to include all columns, so we simply clicked OK without doing anything.

How to open JSON files in Excel?

If you forget this step, the data will not load correctly. So, carefully perform all the given steps.

Step 9: You can see that the records have been expanded that the JSON file contains. Now, click the Close & Load option present at the very first place.

How to open JSON files in Excel?

Step 10: You can see that the three records have been loaded into the Excel sheet.

How to open JSON files in Excel?

You can now compare that which data is more readable.

Step 11: The users can exclude the data rows as well from the sheet. For this, click the dropdown icon next to the column header and then unmark the row you want to hide.

How to open JSON files in Excel?

Step 12: See that one record has been hidden for now. However, you can include it again to the table by increasing the width of the table.

How to open JSON files in Excel?

You can also follow our chapter to learn how to unhide rows in Excel.

JSON to Excel conversion online

If you have not MS Excel software downloaded, you can do it online as well. Users can use third-party software to open/convert the JSON file to .xlsx format. After converting it, you can open it in MS Excel software.

Various JSON to Excel conversion softwares available online. You can use them for your JSON file conversion. Using these softwares, you can convert your file in a few seconds. But sometimes, these softwares are not reliable because they convert the data wrongly.

JSON to CSV converter

JSON to CSV converter is an online tool for converting the JSON file to CSV and Excel format. Unlike its name, you can also use this software to convert the JSON file to .xlsx format. It is a tool that you can use for free for online file conversion.

Remember that the users require an internet or wifi connection to use this software because it runs on the internet.

Steps to convert the JSON file to .xlsx

Step 1: Click the following link JSON to CSV to go to the website.

Step 2: On this website, click the Upload JSON file to choose a file from your system.

How to open JSON files in Excel?

«You can upload up to 1MB of JSON and ZIP file for conversion.»

Step 3: A window panel will open to choose the JSON file from the local storage. Go to the location and select a JSON file to upload.

We have created a JSON file named Employee for the previous example, select it and click Open.

How to open JSON files in Excel?

Note: Make sure, All Files must be selected in file type to make the JSON file visible.

Step 4: See that the data has been converted in this way. If you just want to read out the data, you can read it by scrolling the whole data.

How to open JSON files in Excel?

But if you want to save it for later, you can download the converted Excel file so that you can read it offline. Three options are available here.

  1. Download CSV — Click this to download the CSV version of the Excel file.
  2. Excel File (XLSX) — Choose this option to download the Excel version of the converted JSON file.
  3. Copy to Clipboard — The user can also go for this option and copy the data to clipboard. After coping the data, you can paste it in simple text format anywhere.
  4. Do something clever with this result — Apart from all the above options; you can do something different with this converted result.
    For example, you can transfer it to Google spreadsheet, SQLite database, MySQL table dump, FTP, Edit, or generate custom reports. But, some of these options are available only for PRO users.

Step 5: Click the or Excel File (XLSX) to download the Excel version of the JSON file.

How to open JSON files in Excel?

Step 6: See that a .xlsx file has been downloaded as we had clicked on the Excel file (XLSX) button to download the converted file in Excel format.

How to open JSON files in Excel?

Step 20: You can now open and see the converted data in it. Currently, it is in protected view. You can enable editing by clicking the Enable Editing option given in the header of the file.

How to open JSON files in Excel?

Apart from this, there are several other softwares on the internet that you can use to convert the JSON file to XLSX format.

JSON to Excel converter

It is another online tool used for converting the JSON file into Excel. It is also a free software. Using this tool, you can convert the JSON file to Excel 97-2007 and Excel 2007+ versions.

The main advantage of using this tool instead of the above one is — it allows maximum of 10 MB of data for conversion. In contrast, JSON to CSV converter allows only 1 MB of data.

Apart from this, this online tool offers 10 conversions per day and also it is easy to use web app. To know how to use this web application for conversion, follow the steps below:

Step 1: Click the following link JSON to Excel conversion to navigate to the website.

Step 2: On this website, click the Browse button to choose a file from your system.

How to open JSON files in Excel?

Step 3: Choose a JSON file to convert it into Excel format.

How to open JSON files in Excel?

Step 3: We are using Excel 2016, so we choose XLSX (Excel 2007+) radio button here.

How to open JSON files in Excel?

Step 4: Now, scroll down and click the Run Conversion to start converting the file.

How to open JSON files in Excel?

It will take a little bit of time to convert the file.

Step 5: In the end, click the Download File along with the converted file size to download the file.

How to open JSON files in Excel?

Step 6: See that the file has been downloaded. You can now open and see the JSON data in an Excel file.

How to open JSON files in Excel?

Note that — this tool does not allow more than one file conversion at a time.

Open the JSON file in Excel from web

There is one more way to open the JSON file directly from the internet without downloading it into your system. Excel enables the method to import/open the JSON file from the web. Thus, the users do not need to explicitly download the file to system and then follow the process to open the file in Excel. This saves the time of users.

The above methods that we have described are for the files that are stored in local storage. If you have a JSON file on the internet or want to import it from an API call, you can follow the below steps:

Step 1: Open a new Excel file and go to the Data tab.

How to open JSON files in Excel?

Step 2: click the New Query and select From Other Sources then From Web option that will open a modal to access the file from web.

New Query > From Other Sources > From Web

How to open JSON files in Excel?

Step 3: In this modal, choose the Basic radio button and enter the web address of the file inside the URL field, then click OK.

We have provided the following link:

https://filesamples.com/samples/code/json/sample2.json

How to open JSON files in Excel?

Step 4: Keep it default without any change and click Connect here.

How to open JSON files in Excel?

Step 5: Now, a power query editor with data will open like below on which navigate to the Home tab.

How to open JSON files in Excel?

Step 5: In this Home tab, click the Close & Load option present at the very first place.

How to open JSON files in Excel?

Step 6: You can see that the six rows have been loaded into the Excel sheet that we had directly imported from the web.

How to open JSON files in Excel?

Using this method, one can directly load the JSON file to Excel.


Like this post? Please share to your friends:
  • Movie with the word american
  • Ms excel a basic element of spreadsheets is
  • Movie starting with the word the
  • Ms excel 2019 это
  • Ms excel 2016 помощь в работе