# Organize and export sublist for Excel export?

**URL:** <https://forum.dynamobim.com/t/organize-and-export-sublist-for-excel-export/15566>\
**Category:** Lists-Logic\
**Created:** [October 11, 2017, 5:52pm UTC](https://forum.dynamobim.com/t/organize-and-export-sublist-for-excel-export/15566 "2017-10-11T17:52:00Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![glenncai](https://avatars.discourse-cdn.com/v4/letter/g/dc4da7/32.png) [@glenncai](https://forum.dynamobim.com/u/glenncai)\
**Post date:** [October 11, 2017, 5:52pm UTC](https://forum.dynamobim.com/t/organize-and-export-sublist-for-excel-export/15566/1 "2017-10-11T17:52:00Z")

</div>

Hi,  
I’m trying to create and export a schedule for wall panel sets to Excel.  
I’m able to export data of a single panel set(flatten list) without any problems. but how can I export data of sublist and have them organized that way I want in excel(see attachment)? what list logic do I need to get the result I’m looking for?  
Thanks.

 ![SPSW EXPORT](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/4/a4731583c325b1896ed4cd36590613b2515979dc.JPG)  
 ![SPSW EXCEL RESULT](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/d/1dd4927425563627992984d873a5fbb11c99d7e9.JPG)

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [October 11, 2017, 6:44pm UTC](https://forum.dynamobim.com/t/organize-and-export-sublist-for-excel-export/15566/2 "2017-10-11T18:44:45Z")

</div>

Data is sorted by row. So for a list of lists, each sublist represents a single row with each item in that sublist representing a new column.

---

<div class="post-metadata">

**Author:** ![glenncai](https://avatars.discourse-cdn.com/v4/letter/g/dc4da7/32.png) [@glenncai](https://forum.dynamobim.com/u/glenncai)\
**Post date:** [October 11, 2017, 6:59pm UTC](https://forum.dynamobim.com/t/organize-and-export-sublist-for-excel-export/15566/3 "2017-10-11T18:59:28Z")

</div>

Yes,I got the logic by transpose a flatten list. but have the problem when deal with the sublists. I’m playing with the lacing but doesn’t seem work.

 ![SPSW REPLY](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/4/0/400b238f3822b039cb05437e290dccf4c68cc403.JPG)

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [October 11, 2017, 7:16pm UTC](https://forum.dynamobim.com/t/organize-and-export-sublist-for-excel-export/15566/4 "2017-10-11T19:16:37Z")

</div>

Then you need a sheet name for each set of sublists.

---

<div class="post-metadata">

**Author:** ![awilliams](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/awilliams/32/114496_2.png) [@awilliams](https://forum.dynamobim.com/u/awilliams)\
**Post date:** [October 11, 2017, 7:36pm UTC](https://forum.dynamobim.com/t/organize-and-export-sublist-for-excel-export/15566/5 "2017-10-11T19:36:07Z")

</div>

@glenncai Just to be clear, your Levels column is staying the same, so does this mean that the # of items per Panel are == to the # of Levels?

Also, are these elements storing in a parameter the panel group they belong to?

---

<div class="post-metadata">

**Author:** ![glenncai](https://avatars.discourse-cdn.com/v4/letter/g/dc4da7/32.png) [@glenncai](https://forum.dynamobim.com/u/glenncai)\
**Post date:** [October 11, 2017, 8:14pm UTC](https://forum.dynamobim.com/t/organize-and-export-sublist-for-excel-export/15566/6 "2017-10-11T20:14:15Z")

</div>

Hi,awilliams  
Question #1: Yes, the Levels column are always same,one level one item.  
Question #2: Yes, each item has a parameter to id the panel its belongs to. and the sublist result has been grouped and sorted by that parameter.  
Let me know if you come up will any ideas. Thank you for your reply

---

<div class="post-metadata">

**Author:** ![awilliams](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/awilliams/32/114496_2.png) [@awilliams](https://forum.dynamobim.com/u/awilliams)\
**Post date:** [October 11, 2017, 8:31pm UTC](https://forum.dynamobim.com/t/organize-and-export-sublist-for-excel-export/15566/7 "2017-10-11T20:31:56Z")

</div>

@glenncai Glad to hear the answers were both yes 🙂 Since question #1 was yes, no need to get the Levels from the element’s parameter values, just collect the level elements from the project. Since question #2 was yes, use Group by Key to group your elements by their panel parameter value, then List.Map to get the Steel Grade & Type Parameter Values per each Panel group. Then separate each panel group’s parameter values using Get Item at Index.

 ![group by panels](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/1/613e6c6c0d2b9f1c53882ad166d0c3f01c21cb2b.png)

(I am using “Unconnected Height” and “Wall Type” where you would use your Panel and Type parameter)

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [October 11, 2017, 9:06pm UTC](https://forum.dynamobim.com/t/organize-and-export-sublist-for-excel-export/15566/8 "2017-10-11T21:06:30Z")

</div>

I think I see what you’re saying now. So each set of sublists is a panel. You can export a single panel set but you want to export multiple panels side by side with only one column for Level…

If that’s the case you’ll need to sort your panel information without Levels first. You want all your Level 28 info on one line then Level 27 info on the next and so on. Excel only has 2 dimensions (rows and columns) so your lists have to be 2-dimensional (per sheet).

Assuming your lists are already sorted by level, you need to do some fancy list transposals to get your items in the correct order. Then you can just add your unique levels back to the front of each list.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/e/4/e447ea31df9bbafb8c77c4df796bca635a521c6a.png)  
Export (without the column headers, but you get the point 😉 )  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/b/7/b7b99ec2957d32c0f52f82857019b611043cb2e2.png)

---

<div class="post-metadata">

**Author:** ![awilliams](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/awilliams/32/114496_2.png) [@awilliams](https://forum.dynamobim.com/u/awilliams)\
**Post date:** [October 11, 2017, 9:29pm UTC](https://forum.dynamobim.com/t/organize-and-export-sublist-for-excel-export/15566/9 "2017-10-11T21:29:57Z")

</div>

Looks like @Nick_Boyts’ method works as well! I realized after reading his solution that you probably still do want to be pulling the Level value from the elements. So a revised version of the method I gave above would be to first group the elements by their levels, and also include getting their level parameter with List.Map

 ![group by panels](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/6/f6d2770c1b7dc263587535738d1d2a731619a6eb.png)

---

<div class="post-metadata">

**Author:** ![awilliams](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/awilliams/32/114496_2.png) [@awilliams](https://forum.dynamobim.com/u/awilliams)\
**Post date:** [October 11, 2017, 9:38pm UTC](https://forum.dynamobim.com/t/organize-and-export-sublist-for-excel-export/15566/10 "2017-10-11T21:38:40Z")

</div>

@Nick_Boyts’ method makes more sense to use @glenncai considering your script is already set up with that list structure. 🙂 My method would rework the way you collect your values to end up with a different list structure.

---

<div class="post-metadata">

**Author:** ![glenncai](https://avatars.discourse-cdn.com/v4/letter/g/dc4da7/32.png) [@glenncai](https://forum.dynamobim.com/u/glenncai)\
**Post date:** [October 11, 2017, 11:45pm UTC](https://forum.dynamobim.com/t/organize-and-export-sublist-for-excel-export/15566/11 "2017-10-11T23:45:23Z")

</div>

Hi, Nike  
That works awesome, but I need to add one more transpose to allow the panels reads from left to right. Sorry I did not explain it clearly. Thanks

 ![SPSW REPLY](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/c/c/cc7273880f626050cd28289005df66a12784347a.JPG)  
 ![SPSW EXCEL RESULT](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/e/8/e84c7c6bbea20ee61eac1ecac885bb5f8190d534.JPG)

---

<div class="post-metadata">

**Author:** ![glenncai](https://avatars.discourse-cdn.com/v4/letter/g/dc4da7/32.png) [@glenncai](https://forum.dynamobim.com/u/glenncai)\
**Post date:** [October 11, 2017, 11:53pm UTC](https://forum.dynamobim.com/t/organize-and-export-sublist-for-excel-export/15566/12 "2017-10-11T23:53:09Z")

</div>

Hi, Awilliams  
Thanks for your help too

---

<div class="post-metadata">

**Author:** ![awilliams](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/awilliams/32/114496_2.png) [@awilliams](https://forum.dynamobim.com/u/awilliams)\
**Post date:** [October 12, 2017, 12:19am UTC](https://forum.dynamobim.com/t/organize-and-export-sublist-for-excel-export/15566/13 "2017-10-12T00:19:39Z")

</div>

You’re saying want the P1, P2, P3 and P4 to read left to right, do you mean you want them to be their own row rather than a column, basically as headers? Right now your data _is_ presenting the data per each panel from left to right, so i’m assuming you mean you want the panels as headers.

If I’m understanding correctly, then I would remove the first List.Create node and feed the list you were putting in for item 1 into the first List.Transpose. Then add this line of code into a code block and feed it into your “List.AddItemsToFront” node and see if this gives you the results you’re looking for:

```
DSCore.List.Transpose({{"Level"},{"P1"},{" "},{"P2"},{" "},{"P3"},{" "},{"P4"},{" "}});
```

---

<div class="post-metadata">

**Author:** ![glenncai](https://avatars.discourse-cdn.com/v4/letter/g/dc4da7/32.png) [@glenncai](https://forum.dynamobim.com/u/glenncai)\
**Post date:** [October 12, 2017, 12:45am UTC](https://forum.dynamobim.com/t/organize-and-export-sublist-for-excel-export/15566/14 "2017-10-12T00:45:16Z")

</div>

I cycle the repeat headers to # of panels happens and add “Level” to the beginning. This give me the result I want. I do not need to put P1,P2… for the each sub header for now, but would like to group “Steel Grade” & “Type” into a main upper level header call “P1,P2,P3…and so on” just like the image shown on the first post. not sure Dynamo allows me to merge cells in excel.

 ![SPSW REPLY](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/9/6/96e0b25f0cd9fcfd604a0afb2a6584b3329a8343.JPG)

---

<div class="post-metadata">

**Author:** ![awilliams](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/awilliams/32/114496_2.png) [@awilliams](https://forum.dynamobim.com/u/awilliams)\
**Post date:** [October 12, 2017, 12:50am UTC](https://forum.dynamobim.com/t/organize-and-export-sublist-for-excel-export/15566/15 "2017-10-12T00:50:01Z")

</div>

@glenncai You will have to merge cells in Excel after you’ve written the data to the file. Dynamo can’t control for merging cells to my knowledge. Try the following though, and it will give you outputs you can quickly merge the cells to reach your desired result.

Add a Code Block with the following code:  
`DSCore.List.Transpose({{" "},{"PANEL 1"},{" "},{"PANEL 2"},{" "},{"PANEL 3"},{" "},{"PANEL 4"},{" "}});`

Add another List.AddItemToFront node after your first one, and feed the above code block into the “item” input and feed the output from the first List.AddItemToFront node into "list.

Try that and let me know if this is more like the results you are looking for. 🙂

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [October 12, 2017, 3:34am UTC](https://forum.dynamobim.com/t/organize-and-export-sublist-for-excel-export/15566/16 "2017-10-12T03:34:57Z")

</div>

> [@awilliams](#):
>
> Dynamo can’t control for merging cells to my knowledge.

If excel can do something programmatically than Dynamo Excel can do it as well… That said this may not yet have been exposed in any availabe package. See here:

> [@Bumblebee package: Format: merge cells](https://forum.dynamobim.com/t/bumblebee-package-format-merge-cells/3853):
>
> Hi everyone, Is it possible to merge a range of Excel cells in excel using a node from the Bumblebee package? It seems this has been implemented in the Rhino version of Bumblebee… [http://www.grasshopper3d.com/group/bumblebee/forum/topics/bumblebee-2-0-2-update](http://www.grasshopper3d.com/group/bumblebee/forum/topics/bumblebee-2-0-2-update) Thanks for your help!

---

<div class="post-metadata">

**Author:** ![almostfrench](https://avatars.discourse-cdn.com/v4/letter/a/67e7ee/32.png) [@almostfrench](https://forum.dynamobim.com/u/almostfrench)\
**Post date:** [July 14, 2018, 11:56am UTC](https://forum.dynamobim.com/t/organize-and-export-sublist-for-excel-export/15566/17 "2018-07-14T11:56:34Z")

</div>

Hi, I’m new here for Dynamo. I’m in a similar situation but simpler than the OP’s. I don’t need to have each set of sublist next to each other. I need each sublist to be in an individual sheet with the panel name is the sheet name.  
So, panels bearing the same name (on different levels and can have different thickness) will be sorted by levels, and listed in a separate sheet.  
The exported Excel file will have “n” sheets represent “n” panel names. Each of sheet will show those panels’ parameters such as thicknesses (type parameter), concrete grades, reinforcement rates (instance parameter)  
Then another script to read the modified Excel file and change those panels’ parameters in Revit accordingly.  
This is my very first Dynamo script, so please help me.  
Thank you.

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [July 16, 2018, 5:23pm UTC](https://forum.dynamobim.com/t/organize-and-export-sublist-for-excel-export/15566/18 "2018-07-16T17:23:06Z")

</div>

It’s a slightly different problem so I would ask that you start a new post. However, there are many similar posts with writing to multiple sheets in Excel that you could probably look at first. I would recommend getting your graph to work for a single panel before moving on to multiple panels.

---

<div class="post-metadata">

**Author:** ![almostfrench](https://avatars.discourse-cdn.com/v4/letter/a/67e7ee/32.png) [@almostfrench](https://forum.dynamobim.com/u/almostfrench)\
**Post date:** [July 17, 2018, 12:47pm UTC](https://forum.dynamobim.com/t/organize-and-export-sublist-for-excel-export/15566/19 "2018-07-17T12:47:42Z")

</div>

Thanks. I’ll give it ago.  
I’m trying to understand all the posts in this thread but each graph is not finished and I can’t link them together to get a full picture. It’s so difficult for me to understand what you guys were trying to do.  
Can anyone provide a full graph for this panel thing which works? That would help me to learn it.  
Cheers,
