How to extract all JSON values into an Excel file
you can easily do it with pandas
:
import pandas as pd
df_json = pd.read_json(‘DATAFILE.json’)
df_json.to_excel(‘DATAFILE.xlsx’)
or:
import json
import pandas as pd
with open('./SimData/save_to_excel.json') as json_file:
data = json.load(json_file)
df = pd.DataFrame(data)
df.to_excel('./SimData/exported_json_data.xlsx')
You may use Pandas and openpyxl:
First install it pip install pandas openpyxl
, and then:
import pandas as pd
df_json = pd.read_json(‘your_input_file.json’)
df_json.to_excel(‘your_output_file.xlsx’)
Take a look: https://www.marsja.se/how-to-convert-json-to-excel-python-pandas/