Vertical Loop in Excel

I have a scenario, where I need to layout data in both Horizontally and Vertically.
Is this even possible? I can't even figure out how to to a vertical loop.

(Note Real data is very dynamic number of "Departments" and Number of "Employees" per department is very variable.

The result I need is:

Sample JSON that matches the data above.

{
"departments": [
{
"Name": "Sales",
"employees": {
"employee": [
{
"id": "1",
"firstName": "Tom",
"salary": 80000
},
{
"id": "2",
"firstName": "Maria",
"salary": 95000
},
{
"id": "3",
"firstName": "Robert",
"salary": 70000
}
]
}
},
{
"Name": "Accounting",
"employees": {
"employee": [
{
"id": "10",
"firstName": "Jim",
"salary": 65000
},
{
"id": "22",
"firstName": "Susan",
"salary": 100000
}
]
}
}
]
}

Hello @sphilson,

Excel templating engine support dynamic tables, loops and nesting and other things.

You can find some examples in the user guide.

If it doesn't work for your case, could you share your excel sample and we'll try to get something similar to your result?

Best regards,
Petr
Plumsail team