Update Room Numbers


I will update the room numbers via. Excel…
In the Excel sheet below can you see the element IDs on the left column and the new room numbers I want on the right column…
Can anyone help getting these rooms updated to their new room numbers?


In a codeblock Revit.Element.SelectorById(Id, true) will select the Room by Id, ElementSetParameterByName will update its Number.
In WorkShared project it may be better to use the UniqueId instead.


Hey Marcel,
Thanks for the help. But…

When I try the first script, my room numbers change but doesn’t go in right the order…
And I cant find all these code in that script with UniqueID.

Is there any way to tell Dynamo that i only want to work with the ElementsID that I have on the left side column and change the room numbers? I want the order to be the same as the excel sheet…

I am new here and appreciate all your helps! :slight_smile:

First you need an excel sheet that is recent (rooms may have been deleted or new ones may have been placed)
And please post an image of your script so we can have a look.

Here is the recent room schedules. The orange/pink column are the old room numbers, who I will update with the yellow column.

Her is the script I have work with. The room numbers change but doesn’t in right order.

Please update your script, i can’t see any ElementSelector in there.

Here Marcel… The room name change but in wrong order…

Instead of trying to wrestle with sorting and ordering your lists of Rooms, just make a old-new number dictionary from the data in the excel file.

Then read all the rooms and find the right NewNumber to the OldNumber.

The order of the rooms as you are reading them has no guarantee that it is the same as in your Excel file. Even more so when you start sorting or sequencing in Excel.

It would also eliminate the need to select by ID and thus avoid any trouble with Rooms that were deleted or moved in the time it takes you to generate and check the new numbering scheme.

1 Like

The reason you don’t get the correct result is because you are using two different source documents.
You should only use the excel document.

Use the data from index 0 (ElementId) to feed into a codeblock that reads
Revit.Element.SelectorById(Id , true), Use text to number conversion if needed, use the output of the codeblock as input for the elements port in the ElementSetParameterByName node.
Use the data from index 4 (the new values) as input for the value in the ElementSetParameterByName.