My current task involves extracting data from Excel using JavaScript. The extracted output is structured as follows:
{
"Responsible": "Grey",
"Goal": 0.823,
"Jan": 0.8621397507374327,
"Feb": 0.8605700219733681,
"Mrz": 0.8870898346258058,
"Apr": 0.8529801908413164,
"Mai": 0.8507431241640211
}
To enhance the presentation of this data, I aim to split it into smaller subsets like below:
{
"Responsible": "Grey",
"Goal": 0.823,
"Month": 0.8621397507374327,
}
{
"Responsible": "Grey",
"Goal": 0.823,
"Month": 0.8605700219733681,
}
{
"Responsible": "Grey",
"Goal": 0.823,
"Month": 0.8870898346258058,
}
{
"Responsible": "Grey",
"Goal": 0.823,
"Month": 0.8529801908413164,
}
{
"Responsible": "Grey",
"Goal": 0.823,
"Month": 0.8507431241640211
}
Below is a snippet of my code implementation for achieving this:
Ausgabe = [];
_.forEach(data, element => {
obj = {
Responsible: element.Responsible,
Goal: element["Goal \r\n2022"] ,
Jan : element["Jan-22"],
Feb: element["Feb-22"],
Mrz : element["Mar-22"],
Apr : element["Apr-22"],
Mai : element["May-22"],
}
Ausgabe.push(obj)
})
The 'data' field holds the necessary information and can be manipulated if needed. It is expected to return the processed data upon completion.