# Update Room Numbers

**URL:** <https://forum.dynamobim.com/t/update-room-numbers/49601>\
**Category:** Revit\
**Tags:** revit, excel, dynamo\
**Created:** [April 21, 2020, 10:56am UTC](https://forum.dynamobim.com/t/update-room-numbers/49601 "2020-04-21T10:56:41Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![canx0038](https://avatars.discourse-cdn.com/v4/letter/c/6f9a4e/32.png) [@canx0038](https://forum.dynamobim.com/u/canx0038)\
**Post date:** [April 21, 2020, 10:56am UTC](https://forum.dynamobim.com/t/update-room-numbers/49601/1 "2020-04-21T10:56:41Z")

</div>

Hello,

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?

![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/d/1/d1719a6f750677d722ba6893bc6e23a18171a4ce.png)

---

<div class="post-metadata">

**Author:** ![Marcel\_Rijsmus](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/marcel_rijsmus/32/8539_2.png) [@Marcel\_Rijsmus](https://forum.dynamobim.com/u/Marcel_Rijsmus)\
**Post date:** [April 21, 2020, 11:23am UTC](https://forum.dynamobim.com/t/update-room-numbers/49601/2 "2020-04-21T11:23:27Z")

</div>

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.

> **[Practical Dynamo - Excel Linking 2: Keeping Track of Your Families](http://bimtroublemaker.blogspot.com/2014/09/practical-dynamo-excel-linking-2.html)**
>
> There is an advantage to living in a small city/country with a disproportionately large contingent of ADSK employees: I have great access t...

---

<div class="post-metadata">

**Author:** ![canx0038](https://avatars.discourse-cdn.com/v4/letter/c/6f9a4e/32.png) [@canx0038](https://forum.dynamobim.com/u/canx0038)\
**Post date:** [April 21, 2020, 12:00pm UTC](https://forum.dynamobim.com/t/update-room-numbers/49601/3 "2020-04-21T12:00:41Z")

</div>

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! 🙂

---

<div class="post-metadata">

**Author:** ![Marcel\_Rijsmus](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/marcel_rijsmus/32/8539_2.png) [@Marcel\_Rijsmus](https://forum.dynamobim.com/u/Marcel_Rijsmus)\
**Post date:** [April 21, 2020, 12:12pm UTC](https://forum.dynamobim.com/t/update-room-numbers/49601/4 "2020-04-21T12:12:23Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![canx0038](https://avatars.discourse-cdn.com/v4/letter/c/6f9a4e/32.png) [@canx0038](https://forum.dynamobim.com/u/canx0038)\
**Post date:** [April 21, 2020, 12:17pm UTC](https://forum.dynamobim.com/t/update-room-numbers/49601/5 "2020-04-21T12:17:50Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/6/76e86cf8aeb31e7025358eff0cf7569eae9a11a1.png)

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

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/b/1b86bdbeb52b12953f3251bdbbd26174acac936f.png)

---

<div class="post-metadata">

**Author:** ![Marcel\_Rijsmus](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/marcel_rijsmus/32/8539_2.png) [@Marcel\_Rijsmus](https://forum.dynamobim.com/u/Marcel_Rijsmus)\
**Post date:** [April 21, 2020, 12:25pm UTC](https://forum.dynamobim.com/t/update-room-numbers/49601/6 "2020-04-21T12:25:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![canx0038](https://avatars.discourse-cdn.com/v4/letter/c/6f9a4e/32.png) [@canx0038](https://forum.dynamobim.com/u/canx0038)\
**Post date:** [April 21, 2020, 1:04pm UTC](https://forum.dynamobim.com/t/update-room-numbers/49601/9 "2020-04-21T13:04:40Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/4/9/4929b8d70c9730294507dd6f417d895eb0e7092d.png)

---

<div class="post-metadata">

**Author:** ![Bjorn\_Keulemans1](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/bjorn_keulemans1/32/54676_2.png) [@Bjorn\_Keulemans1](https://forum.dynamobim.com/u/Bjorn_Keulemans1)\
**Post date:** [April 22, 2020, 8:57am UTC](https://forum.dynamobim.com/t/update-room-numbers/49601/10 "2020-04-22T08:57:36Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Marcel\_Rijsmus](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/marcel_rijsmus/32/8539_2.png) [@Marcel\_Rijsmus](https://forum.dynamobim.com/u/Marcel_Rijsmus)\
**Post date:** [April 22, 2020, 2:52pm UTC](https://forum.dynamobim.com/t/update-room-numbers/49601/11 "2020-04-22T14:52:47Z")

</div>

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.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/9/4/943123420f1c5e8fdb88a9e0bc0bb210d7dcc7cb.png)  
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.
