Using dictionaries with Excel and parameters?


I’m quite new to Dynamo, know some Python, but I have to get used to applying it in the right way in Dynamo and simplify my Dynamo script.
Here is my current task, which is probably a bit too big already.

I have a Excel file that looks like this:

I haven’t put in all the data for each column and row but it’s around 30 columns and probably around 35 rows with long string values. Nothing anyone wants to do by hand.
Each value in the “DK” column is basically a dictionary key and can get compared to multiple elements with the same key as parameter, in this case all doors in the project.

All the other columns represent shared parameters that should get filled into the object.
There can be multiple doors with the same DK-value, in total I have 181 doors but only ~35 DK-values.

I started of using Lookup Tables in the family, but they were not so “ÅÖÄ”-friendly. So now I thought of Dynamo. But it doesn’t even run with my current 7 parameters and I’m sure there is a better way, it became to complex I guess.

Can anyone help me here? I googled forever and watched tons of youtube videos but it always seemed to be a list of elements that gets compared to an excel sheet and filled 1:1.

Thank you in advance!

@johannes welcome to the forum
Please use the camera button (top right) to make a picture of your script, the picture in this post is impossible to read.
Also, show previews and the errors on the yellow nodes.
Thank you

Hi @Marcel_Rijsmus,
Thank you, I think I’ll spend a lot of time here… :smiley:

I actually used the camera button, but it apparently doesn’t include titles if you don’t zoom in to see them in the viewport.

Unfortunately my Dynamo/Revit crashed and I lost a lot of my experiment. What I do now looks way simplier, but it still doesn’t work.

The same Excel, but I dropped the index:

And the new dynamo script, with all headers:

If it helps, I can add the excel and dynamo file as well:
Dörrkort.dyn (32.3 KB) dorrkort.xlsx (10.3 KB)

The python script is extremely simple:

This is the error message:

It feels like I got closer, but not really where I need to be. To make clear what I would like to do now for my 181 doors. I would like to take the list of values by door and apply them for each parameter name. And even better if I could replace all “null” objects in the value list. This is what I’m thinking of:

with something like “-”.

Hi @johannes,

Perhaps you can find some inspiration in this post.

Your case is not as straight forward, but Im convinced you can apply the same logic if you get your doors grouped by DK# :slightly_smiling_face:


try this.

1 Like

Thank you!

It works, even though I get an error… No clue why, the data gets copied over :slight_smile:

Dörrkort.dyn (42.0 KB)

As long as everything is copied when I do the whole list of doortypes I’m happy! Thank you for your help!

Ambiguous means Dynamo has two methods with the same name and it can’t choose which one to take.
This is probably due to an old package installed or something like that.
Try uninstalling your packages and reload only the newest version or the version compatible with your Dynamo version.

1 Like