I’m trying to pull the name of the material class from the Excel sheet’s name. First sheet name is “CT”, Second sheet name 'SF", and third sheet name is “VF”. Each Excel sheet has rows of material information with a description, comments, manufacturer, model, and mark. Each row of information becomes a separate material in Revit. I need to duplicate the sheet name as a class for each row.
I can pull the sheet name, but can’t make it duplicate and align with the rows from each sheet.
Hello, and welcome.
Your explanation is a bit confusing without files or screenshots. If you could show us your script (use the “export as image” with all previews open so we can see the data) and the excel file, it would probably clarify your intention.
1 Like
Hello, I added an image of the dynamo to my original post. Please let me know if it helps.
Also, in the image in this post, you can see the Excel file I am using. The sheet name is a circle, and I would like to use it in the material class in Revit. So, I need to be able to pull the sheet name and duplicate it, basically adding another column with CT for each row.
Thanks for the images. One tip, when exporting image from dynamo, try to zoom in and make all nodes names visible, this way it’s easier to identify what’s happening. Also pin the data preview so we can see it being modified.
On the problem itself, it seems a bit overengineered. If what you need is to create a column in excel with the same value in every row, wouldn’t it be easier to just edit the spreadsheet manually, since it’s just that, then work with the modified version in Dynamo? Unless of course there’s something else to it I’m not fully understanding.
I say this from the place of someone that loves automation and things working by themselves, but sometimes it’s just easier to do the simple way.
Let me know if that’s the case, or if there’s something else to it 
Yeah, I can get it to work by just adding a column. But I was trying to avoid that, mainly because the team would have to worry about another column to add information to, and if I could pull the information from the sheet name that I thought would make it simple…lol..lol. Which is proving not to be so simple…lol
haha i get it. You can actually do that, just count how many rows you have data, cycle the sheet name and append it to the list from where the data was extracted. The problem with that is then your original excel file structure will have changed, and your original script will probably need to be updated.
So even though there’s a way, I still recommend structuring your data accordingly, then working with it, even if it means adding the column and leaving it blank so what yous script reads have the same settings as what your script writes. This way it becomes more straightforward.
I just got it to work by:
*Use “List.Count” to get the number of rows in each sheet.
*transpose the list “List. Transpose”
*Then use “List.ofRepeatedItem” to repeat
*I then had to deconstruct the list “List. Deconstruct”
*Transpose the list “List .Transpose”
*Then flatten the list “List .Flatten”
*Last I used GeniusLoci “Material Set Class”
For additional information - you can access Excel sheets via the Python pandas library [Dynamo 2.18+ / Revit 2024+]
Also TIL you can change the port naming on python nodes