Order of sheets in excel export

Hey everybody!

Would someone in here be able to tell me how excel/dynamo comes up with the order of the sheets in excel? I have made a script where data on many different elements gets exported to the same file, but also a “List.Join”. I want the data from the “List.Join” to be the first sheet in excel since it is my “Overview” sheet. I hope it makes sense…


image

Excel data follows a singular structured format: an @L3 list where the top-level list represents the sheet, the sublists represent the rows, and the items in the sublists represent the cells (column values) in each respective row. This means that the writing to multiple sheets requires an @L4 list where you have a list of the above @L3 structures - one for each sheet.

Setup each dataset so you could write to a single sheet and then create a list of all datasets and a list of all sheet names. You’re literally just making a list of all the expected structures.

I have this setup for many different categories such as doors, windows etc. In the “Missing Export” is the data which i want to place in different sheets. In the “Overview” is the mixed overview of all the elements, but i want the “Overview” sheet to be the first sheet in the list. Which nodes would you use to go from the export and list.join note to something that fixes my problem? :slight_smile:

image

We can’t see anything in your screenshot. You’re zoomed out too far for the node titles to be visible and you haven’t shown any of your data.

If you want one sheet of data to be first then you just have to add it to the front of the list or create the list with that data first. That’s all there is to it.

But how do I go from many separate “export to excel” nodes (the one labeled Missing Export) to “add it to the front of the list”? Right now it just goes directly to the File Path so I dont use a list-node at the moment. I dont think I can go from the export to excel-node to list.join? :slight_smile:

You can export multiple datasets to multiple sheets with one node. That’s the list structure you’re after. You need a list of sheet names and a list of datasets. You can provide those inputs to the export node.

Try searching the forum for similar topics. There should be multiple threads that tackle this situation.

I cant seem to get it to work :frowning:

This is basically what i have done, which gives me she sheets in excel in a random order… :open_mouth:

And i want to be able to choose which sheet (DOORS or WINDOWS) that is the first sheet when opening the excel file

I know how to get the order of the sheets right now… But my problem is still that the “data” has to be connected in a way so that every sheet gets its own and not a List.join, because it makes all the data show in every sheet

Thank you for your help!

For multiple datasets/sheets, you don’t want to write to the same file multiple times. You want to write to it once with every sheet. That’s why you need to combine the sheetName inputs and the data inputs into their own lists.

You could still get the same outcome by individually writing your two datasets to the same file but you might run into file access issues. You would just have to use a wait node to force one sheet to write first and the second to write after.

My problem is that all the data ends up in both sheets? I need the data from the doors to be in a sheet called “DOORS” and it to have a header in the sheet called “Doors”. This is what I end up with :slight_smile:

We can’t see what your data looks like in Dynamo if you don’t show it in a preview bubble or watch node, but you have your sheets/data mixed up right now. You’re writing your door data to the windows sheet and your windows data to the door sheet. The order needs to be the same between sheet names and sheet data.

1 Like