I am having problems when I want to export data to Excel with a custom table
The number of bab corresponds to the data in the bab array and the number of children in the bab also depends on the number of arrays in the type
const data = [
{
student: [
{
studentId: 1,
name: "jhon",
},
{
studentId: 2,
name: "kelvin",
},
{
studentId: 3,
name: "bagas",
},
],
data: {
teacher_name: "guru baik",
teacher_id: "02",
class_name: "X 1",
class_id: "cls01",
subject_id: "sbj01",
subject_name: "bahasa indonesia",
},
bab: [
{
name: "bab 1",
bab_name: "Keterampilan",
type: [
{
name: "harian 1",
materi: "materi 1",
materi_prosem: "materi prosem 1",
nilai: [
{ id: "aaa", studentId: 3, value: 100 },
{ id: "bbb", studentId: 2, value: 90 },
{ id: "ccc", studentId: 1, value: 79 },
],
},
{
name: "harian 2",
materi: "materi 2",
materi_prosem: "materi prosem 2",
nilai: [
{ id: "ddd", studentId: 1, value: 22 },
{ id: "eee", studentId: 2, value: 88 },
{ id: "fff", studentId: 3, value: 45 },
],
},
],
},
{
name: "bab 2",
bab_name: "Toleransi",
type: [
{
name: "harian 1",
materi: "materi 1",
materi_prosem: "materi prosem 1",
nilai: [
{ id: "ggg", studentId: 1, value: 77 },
{ id: "hhh", studentId: 2, value: 99 },
{ id: "iii", studentId: 3, value: 46 },
],
},
{
name: "harian 2",
materi: "materi 2",
materi_prosem: "materi prosem 2",
nilai: [
{ id: "jjj", studentId: 1, value: 21 },
{ id: "kkk", studentId: 2, value: 23 },
{ id: "lll", studentId: 3, value: 47 },
],
},
{
name: "harian 3",
materi: "materi 3",
materi_prosem: "materi prosem 3",
nilai: [
{ id: "mmm", studentId: 1, value: 43 },
{ id: "nnn", studentId: 3, value: 44 },
{ id: "ooo", studentId: 2, value: 71 },
],
},
],
},
],
},
];
Can the data variables be exported to Excel, then the export results are as shown in the picture. and how to do it?
the display in excel that I expected