My Excel has many data table which i want to convert it into a Json in javascript/typescript. Following are the sample of my excel data in one sheet separated by one or more empty rows.
Name | Age |
---|---|
John | 40 |
Olivia | 30 |
EmpId | Salary | LanguagesKnown |
---|---|---|
43567 | 15000 | English,French |
98543 | 20000 | Arab,Chinese |
I want to convert these into Json.
Expected output:
**Json for first table:**
{
"Name" : "John",
"Age" : 40
}
{
"Name" : "Olivia",
"Age" : 30
}
**Json for Second Table:**
{
"EmpId" : 43567,
"Salary" : 15000,
"LanguagesKnown" : ["English","French"]
}
{
"EmpId" : 98543,
"Salary" : 20000,
"LanguagesKnown" : ["Arab","Chinese"]
}
CodePudding user response:
[
{
"0": 1,
"First Name": "Dulce",
"Last Name": "Abril",
"Gender": "Female",
"Country": "United States",
"Age": 32,
"Date": "15/10/2017",
"Id": 1562
},
{
"0": 2,
"First Name": "Mara",
"Last Name": "Hashimoto",
"Gender": "Female",
"Country": "Great Britain",
"Age": 25,
"Date": "16/08/2016",
"Id": 1582
},
{
"0": 3,
"First Name": "Philip",
"Last Name": "Gent",
"Gender": "Male",
"Country": "France",
"Age": 36,
"Date": "21/05/2015",
"Id": 2587
},
{
"0": 4,
"First Name": "Kathleen",
"Last Name": "Hanner",
"Gender": "Female",
"Country": "United States",
"Age": 25,
"Date": "15/10/2017",
"Id": 3549
},
{
"0": 5,
"First Name": "Nereida",
"Last Name": "Magwood",
"Gender": "Female",
"Country": "United States",
"Age": 58,
"Date": "16/08/2016",
"Id": 2468
},
{
"0": 6,
"First Name": "Gaston",
"Last Name": "Brumm",
"Gender": "Male",
"Country": "United States",
"Age": 24,
"Date": "21/05/2015",
"Id": 2554
},
{
"0": 7,
"First Name": "Etta",
"Last Name": "Hurn",
"Gender": "Female",
"Country": "Great Britain",
"Age": 56,
"Date": "15/10/2017",
"Id": 3598
},
{
"0": 8,
"First Name": "Earlean",
"Last Name": "Melgar",
"Gender": "Female",
"Country": "United States",
"Age": 27,
"Date": "16/08/2016",
"Id": 2456
},
{
"0": 9,
"First Name": "Vincenza",
"Last Name": "Weiland",
"Gender": "Female",
"Country": "United States",
"Age": 40,
"Date": "21/05/2015",
"Id": 6548
}
]
CodePudding user response: