Как экспортировать json в excel

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.

О конвертировании JSON данных в Excel файл

Конвертер JSON в Excel была создана для быстрого преобразования данных JSON(JavaScript Object Notation) в Excel(электронные таблицы Microsoft Excel).

Как это работает?

Просто вставьте или загрузите JSON данные в текстовое поле выше и нажмите кнопку Конвертировать и Скачать, и вы сразу получите Excel файл.

Пример преобразования JSON в Excel

Исходные данные (До):

{
	"root":
	{
		"rows": [
		{
			"LatD": "41",
			"LatM": "5",
			"LatS": "59",
			"NS": "N",
			"LonD": "80",
			"LonM": "39",
			"LonS": "0",
			"EW": "W",
			"City": "Youngstown",
			"State": "OH"
		},
		{
			"LatD": "42",
			"LatM": "52",
			"LatS": "48",
			"NS": "N",
			"LonD": "97",
			"LonM": "23",
			"LonS": "23",
			"EW": "W",
			"City": "Yankton",
			"State": "SD"
		},
		{
			"LatD": "46",
			"LatM": "35",
			"LatS": "59",
			"NS": "N",
			"LonD": "120",
			"LonM": "30",
			"LonS": "36",
			"EW": "W",
			"City": "Yakima",
			"State": "WA"
		},
		{
			"LatD": "42",
			"LatM": "16",
			"LatS": "12",
			"NS": "N",
			"LonD": "71",
			"LonM": "48",
			"LonS": "0",
			"EW": "W",
			"City": "Worcester",
			"State": "MA"
		},
		{
			"LatD": "43",
			"LatM": "37",
			"LatS": "48",
			"NS": "N",
			"LonD": "89",
			"LonM": "46",
			"LonS": "11",
			"EW": "W",
			"City": "Wisconsin Dells",
			"State": "WI"
		}]
	}
}

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. 

Файлы нотации объектов JSON или Javascript широко используются для хранения различных типов данных. Помимо хранения, они также используются для передачи данных между двумя серверами, и вы часто обнаружите это при общении с веб-сервером через API или что-то еще. Файлы JSON имеют довольно простую структуру, т. е. содержат массивы и объекты. В типичном файле JSON вы найдете пары ключ-значение, которые хранят данные внутри различных объектов, хранящихся в массиве. Доступ к данным можно получить, указав индекс вместе с ключом значения.

Преобразование JSON в Excel

Как оказалось, структура файла JSON, хотя и является базовой для программиста или разработчика, обычному пользователю может быть утомительной для чтения. К счастью, в таком сценарии вы можете легко преобразовать файл JSON в лист Microsoft Excel, по которому может легко перемещаться и обычный пользователь. Это связано с тем, что листы Excel обеспечивают лучшую читаемость, а если у вас есть большой файл JSON, преобразование его в лист Excel может быть подходящим способом, если вы хотите быстрее переварить данные внутри.

Чтобы преобразовать файл JSON в лист Excel, вы можете использовать функцию «Получить и преобразовать» Microsoft Excel. В более старых версиях Microsoft Excel это может называться Power Query. Как оказалось, помимо ручного преобразования файла JSON в Excel, вы также можете использовать онлайн-инструмент, который сделает эту работу за вас. С учетом сказанного давайте начнем и покажем вам, как довольно легко преобразовать JSON в Excel.

Преобразование файла JSON в рабочий лист Excel довольно просто, и процесс довольно прост. Вы начинаете с импорта нужного файла JSON в Microsoft Excel. После импорта файла различные функции приложения Excel используются для преобразования данных внутри файла JSON в таблицу. Как оказалось, Excel поставляется с множеством различных функций, которые позволяют вам манипулировать данными, которые у вас есть внутри файла Excel. Кроме того, вы можете защитить свои данные, защитив файлы Excel паролем.

После преобразования данных в формат таблицы вы можете выбрать, какие данные вас интересуют. Это позволит вам фильтровать данные внутри файла JSON и перечислять только те значения в столбцах, которые необходимы. Все это делается в окне редактора Power Query. Следуйте инструкциям, приведенным ниже, чтобы сделать все это:

  1. Прежде всего, откройте файл Excel на своем компьютере.
  2. Открыв файл Excel, щелкните параметр «Данные» на ленте меню.Опция данных в ленте меню
  3. После этого под лентой меню щелкните раскрывающееся меню «Получить данные», расположенное в самом левом углу.Параметр получения данных Excel
  4. В раскрывающемся меню выберите параметр «Из файла» > «Из JSON».Загрузка файла JSON в Excel
  5. В появившемся окне «Импорт данных» перейдите туда, где хранится файл JSON, и откройте его. Это позволит импортировать файл JSON на лист Microsoft Excel.
  6. После импорта файла JSON откроется окно редактора Power Query.Редактор Power Query
  7. В левом верхнем углу нажмите на предоставленную опцию «К таблице».К столу
  8. В следующем диалоговом окне оставьте параметры по умолчанию и нажмите кнопку ОК.Преобразование в формат таблицы
  9. После этого данные были преобразованы в таблицу. Тем не менее, вы по-прежнему не можете видеть данные.
  10. Чтобы увидеть данные, вам придется развернуть значки. Для этого щелкните предоставленный значок «Развернуть столбец» (с двойными стрелками, направленными друг от друга).Щелчок по значку расширения столбца
  11. В появившемся диалоговом окне выберите столбцы, которые вы хотите видеть, и снимите флажки с тех, которые вы хотите исключить. Сделав это, нажмите кнопку ОК.Выбор столбцов для отображения
  12. Наконец, вы должны увидеть данные, перечисленные в отдельных столбцах.
  13. Для вашего удобства вы можете перемещать различные столбцы на листе. Для этого щелкните правой кнопкой мыши заголовок столбца и в раскрывающемся меню выберите параметр «Переместить».Перемещение столбца
  14. Оттуда вы можете переместить столбец влево, вправо, в начало или в конец.
  15. Когда вы будете удовлетворены компоновкой листа Excel, щелкните предоставленную опцию «Закрыть и загрузить».Закрыть и загрузить вариант
  16. Когда вы это сделаете, данные будут импортированы на ваш лист Excel из редактора Power Query, и вы сможете просмотреть таблицу.Преобразование JSON в Excel
  17. Сделав это, вы успешно преобразовали файл JSON в рабочий лист Excel.

Конвертируйте файл JSON с помощью онлайн-инструмента

Наконец, как оказалось, в дополнение к руководству, о котором мы упоминали выше, вы также можете избавить себя от всех проблем с преобразованием файла JSON вручную и вместо этого выбрать онлайн-инструмент. Использование онлайн-инструмента может быть намного проще и быстрее, так как вам нужно всего лишь загрузить файл JSON, который вы хотите преобразовать в рабочий лист Excel. Есть несколько веб-сайтов, которые предлагают эту функцию, и вы можете легко найти их с помощью одного веб-поиска. Итак, если вам не хочется решать все проблемы с преобразованием файла JSON вручную, у вас всегда есть возможность воспользоваться онлайн-инструментом, который сделает работу за вас намного быстрее.

Microsoft Excel logo on a green background.

To import a JSON file into Excel, open Excel to the Data tab and navigate to Get Data > From File > From JSON. Pick how you want your data to be imported, and Excel will handle the rest automatically.

Have you received a JSON file that you’d like to convert to Microsoft Excel format? Excel offers a built-in option to help you import it without third-party parsing tools. Here’s how you can do it.

RELATED: How to Parse JSON Files on the Linux Command Line with jq

To convert your JSON file to Excel, you will first connect Excel to your JSON data. You’ll then review the JSON data, select the columns you’d like to bring to your Excel file, and finally load the data into an Excel spreadsheet.

You will then save that spreadsheet as an XLSX file, and your JSON to Excel conversion is done.

Import a JSON File Into an XLSX File

To start parsing a JSON file, open Microsoft Excel on your computer and start a new spreadsheet.

On the spreadsheet window, in Excel’s ribbon at the top, click the “Data” tab.

On the “Data” tab, from the “Get & Transform Data” section, select Get Data > From File > From JSON.

You will see your computer’s standard “Import” window. Here, open the folder where your JSON file is located. Double-click the file to connect it to Excel.

Choose the JSON file.

Excel will open a “Power Query Editor” window. Here, you will decide how JSON’s data will be loaded in your spreadsheet. First, at the top of the window, click the “To Table” option. This turns your data into a table.

In the “To Table” prompt, click “OK.”

Select "OK" in the prompt.

To choose which columns to keep in your spreadsheet, next to “Column1,” click the double-arrow icon.

In the menu that opens, choose the columns you’d like to keep. Then, deselect the “Use Original Column Name as Prefix” option and click “OK.”

Your JSON file’s data is now visible in Excel-style columns and rows.

Preview of JSON data in Excel.

If you’d like to remove or change the positions of your columns, right-click a column and choose an appropriate option.

Modify JSON data columns.

When you’re happy with the result, add your JSON data to your Excel spreadsheet by clicking “Close & Load” in the window’s top-left corner.

Your Excel spreadsheet now has your JSON data in it. You can play around with this data however you want. For instance, you can remove the table formatting or even convert the table to a range.

JSON data in an Excel spreadsheet.

Finally, to save this JSON data in Excel format, click “File” in Excel’s top-left corner.

In the left sidebar, click “Save.”

Select "Save" from the left sidebar.

Your computer’s standard “save” window will open. Here, select a folder to save your file in, type a name for your file, and click “Save.”

Select a folder to save the Excel file in.

And that’s it. The Excel version of your JSON file, complete with the .xlsx extension, is now available in your specified folder. Cheers!


Want to convert a Google Sheet to Excel? It’s even easier to do that.

RELATED: How to Convert a Google Sheet to Microsoft Excel

READ NEXT

  • › DevToys for Windows Is Microsoft PowerToys for Developers
  • › How to Change File Type on Windows 10 and 11
  • › Save $300 on Growatt’s Newest Solar Portable Generator, the INFINITY 1300
  • › Discord Direct Message Won’t Go Away? Here’s the Fix
  • › Why ChatGPT Is Not a Replacement for Siri and Google Assistant
  • › Why You Should Use Bionic Reading in Chrome (or Any Browser)
  • › How to Live Stream Every Formula 1 Race for Free in 2023
  • › How to Emulate the GameCube on Your Steam Deck

Понравилась статья? Поделить с друзьями:
  • Как экспортировать html в word
  • Как экспортировать excel для google
  • Как экспортировать excel в phpmyadmin
  • Как экспорт стиля word
  • Как экспорт контакты в excel