I have a Json Which look like
{
"2001":{
"abc":2000,
"bcd":2005
},
"2002":{
"abc":3000,
"bcd":3500
}
}
I want a specific way that converts this Json to excel file. And When that excel file is again converted to Json it should give me above styled json again. Is there any way that I can convert this Json to excel and Excel to Json, but I won't want to change syntex of Json.While the Excel should also show every detail in Json have.
This line fetch data from excel sheet:
var rowMajor = XLSX.utils.sheet_to_json(workbook.Sheets[sheetName], { raw: true, header: 1 });
I am thinking to fetch name of the sheet where the year is been set, and set it as a key to them by local concatenation. Multiple sheet has multiple data which would enclose as seen above in the question. But while reversing the thing 'Json to excel' I am not getting any idea how to do it by code, while the idea to do it is clear.
you can simply use xlsx library
https://www.npmjs.com/package/xlsx
Ex: XLSX.write(wb, {Props:{Author:"SheetJS"}});
wb: is your data.
and inside {} is your file name(SheetJS name of your file).