Formatting Nested List for Excel Export

Hi everyone, this is my first post so sorry if this is a simple question.

I am trying to export a list of elements from a linked file to Excel. I need to export the Element ID, Room Name, and Room Number as columns. I am able to retrieve the information I need, but I am having trouble formatting it for the Excel export.

My problem is there can be several elements in a single room, and they are being listed one level below the room number and names. For example, room NE106, Conference Room, has 6 elements in it.

I would like to repeat NE106 and Conference room 6 times so there is one line for each element ID when exported to Excel. I am thinking of this like a one-to-many join in a database. Please let me know if you have any suggestions!

Edit: version with node previews

I’m sure other methods are available, but I like to use List.Cycle with a double transpose:

This example doesn’t play well with the empty lists. I would remove or replace them with a list.isEmpty node, if you want to include all rooms in the export showing which rooms are empty.

1 Like

Can you show us the node previews for your first image?

Sure, I added this screenshot to the first post.

Thank you, I didn’t know about List.Cycle. I do have a lot of empty lists but I do not not need the rooms with empty lists for element IDs. I will give this a try.

List.AddItemToEnd might be helpful here too as it should keep the proper list structure.

1 Like

Yes, this is perfect. Thank you so much! Life saver :smiley:


Thanks infeeeee, I appreciate your reply too. I had some trouble following it and was able to use the other suggestion for my issue but thank you for taking the time to reply.

1 Like