# Dynamo Script to write area to Excel by room name

**URL:** <https://forum.dynamobim.com/t/dynamo-script-to-write-area-to-excel-by-room-name/19632>\
**Category:** Revit\
**Created:** [March 3, 2018, 5:51pm UTC](https://forum.dynamobim.com/t/dynamo-script-to-write-area-to-excel-by-room-name/19632 "2018-03-03T17:51:35Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stephen\_Blackburn](https://avatars.discourse-cdn.com/v4/letter/s/3d9bf3/32.png) [@Stephen\_Blackburn](https://forum.dynamobim.com/u/Stephen_Blackburn)\
**Post date:** [March 3, 2018, 5:51pm UTC](https://forum.dynamobim.com/t/dynamo-script-to-write-area-to-excel-by-room-name/19632/1 "2018-03-03T17:51:35Z")

</div>

Hello - I am wondering if anyone can help me out with this. I am new to Dynamo, and can’t figure this routine out past a certain point. I am trying to automate Revit room areas to Excel by their department (which can be summarized by their room name). I am working on an apartment project, and want to be able to have Dynamo write to Excel a list showing each department (1 BR, 2 BR, service, etc.) - by floor - with a total area by department. And then (ideally) total them. Such as,

Second Floor  
1 BR - 2,567 SF  
2 BR - 8,070 SF  
3 BR - 4,121 SF  
Corridors - 3,500 SF  
Total - 18,258 SF

I’ve attached a Dynamo routine where I have extracted all the rooms by level, and sorted some of their parameters, such as Name, Number, Area. But my list filtering skills are rudimentary at best . . . is there a way to extract the rooms by level, then by department, then get their areas and total them?  
Thanks!  
Steve B.

[Rooms to Excel-01.dyn](https://forum.dynamobim.com/uploads/short-url/mrgJPo6Hz84aj2qeR1aQz88AngK.dyn) (18.2 KB)

---

<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:** [March 3, 2018, 6:23pm UTC](https://forum.dynamobim.com/t/dynamo-script-to-write-area-to-excel-by-room-name/19632/2 "2018-03-03T18:23:27Z")

</div>

@Stephen_Blackburn

This might help

Marcel

---

<div class="post-metadata">

**Author:** ![simon\_murphy1](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/simon_murphy1/32/101536_2.png) [@simon\_murphy1](https://forum.dynamobim.com/u/simon_murphy1)\
**Post date:** [March 3, 2018, 6:53pm UTC](https://forum.dynamobim.com/t/dynamo-script-to-write-area-to-excel-by-room-name/19632/3 "2018-03-03T18:53:38Z")

</div>

This should get you started. You will need to change the python script to suit the names of departments and levels in your project. If you provide the project here maybe I could look into that.

[filtering rooms by department and level.dyn](https://forum.dynamobim.com/uploads/short-url/vFB5SjqO5dfEa0ggwIZN4urx1tL.dyn) (14.3 KB)

---

<div class="post-metadata">

**Author:** ![Stephen\_Blackburn](https://avatars.discourse-cdn.com/v4/letter/s/3d9bf3/32.png) [@Stephen\_Blackburn](https://forum.dynamobim.com/u/Stephen_Blackburn)\
**Post date:** [March 3, 2018, 9:25pm UTC](https://forum.dynamobim.com/t/dynamo-script-to-write-area-to-excel-by-room-name/19632/4 "2018-03-03T21:25:24Z")

</div>

Thanks! I’ll check it out

---

<div class="post-metadata">

**Author:** ![Stephen\_Blackburn](https://avatars.discourse-cdn.com/v4/letter/s/3d9bf3/32.png) [@Stephen\_Blackburn](https://forum.dynamobim.com/u/Stephen_Blackburn)\
**Post date:** [March 4, 2018, 10:07pm UTC](https://forum.dynamobim.com/t/dynamo-script-to-write-area-to-excel-by-room-name/19632/5 "2018-03-04T22:07:47Z")

</div>

Thanks, Marcel - I will check out this video as soon as I can.

---

<div class="post-metadata">

**Author:** ![Stephen\_Blackburn](https://avatars.discourse-cdn.com/v4/letter/s/3d9bf3/32.png) [@Stephen\_Blackburn](https://forum.dynamobim.com/u/Stephen_Blackburn)\
**Post date:** [March 4, 2018, 10:21pm UTC](https://forum.dynamobim.com/t/dynamo-script-to-write-area-to-excel-by-room-name/19632/6 "2018-03-04T22:21:37Z")

</div>

Simon - I’m not sure how to change the Python Script to suit. I have attached a simple Revit project with some rooms/departments on Levels 1 & 2. How would I take it farther with this?  
Thanks!  
Steve[Sample-01.rvt](https://forum.dynamobim.com/uploads/short-url/xyrMsCEtdu8UyLTLRQS0hwaR9oc.rvt) (1.5 MB)

---

<div class="post-metadata">

**Author:** ![simon\_murphy1](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/simon_murphy1/32/101536_2.png) [@simon\_murphy1](https://forum.dynamobim.com/u/simon_murphy1)\
**Post date:** [March 5, 2018, 2:25pm UTC](https://forum.dynamobim.com/t/dynamo-script-to-write-area-to-excel-by-room-name/19632/7 "2018-03-05T14:25:28Z")

</div>

This should get you started. You will need to add more get\_item\_at\_index nodes to get all of the different rooms.

[filtering rooms by department and level # 2.dyn](https://forum.dynamobim.com/uploads/short-url/rjUxLAAAk6dbV2HpucOYDaAZqVu.dyn) (34.8 KB)

---

<div class="post-metadata">

**Author:** ![Stephen\_Blackburn](https://avatars.discourse-cdn.com/v4/letter/s/3d9bf3/32.png) [@Stephen\_Blackburn](https://forum.dynamobim.com/u/Stephen_Blackburn)\
**Post date:** [March 5, 2018, 6:17pm UTC](https://forum.dynamobim.com/t/dynamo-script-to-write-area-to-excel-by-room-name/19632/8 "2018-03-05T18:17:20Z")

</div>

Simon - I adjusted and ran the latest script you posted. I think I can figure out how to edit the Python scripts included as needed. But how do I carry this thru to calculate the areas of each department by floor? I now end up with a list with the same department, can I now get a room area for that list? The list I end up with seems to be just a list of names (Like “Practice”).

---

<div class="post-metadata">

**Author:** ![simon\_murphy1](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/simon_murphy1/32/101536_2.png) [@simon\_murphy1](https://forum.dynamobim.com/u/simon_murphy1)\
**Post date:** [March 5, 2018, 7:02pm UTC](https://forum.dynamobim.com/t/dynamo-script-to-write-area-to-excel-by-room-name/19632/9 "2018-03-05T19:02:49Z")

</div>

This is as far as I can take it without just doing the whole thing. You should be able to figure out the rest of it. If not maybe take a look at some [Lynda.com](http://Lynda.com) tutorials.

[filtering rooms by department and level # 3.dyn](https://forum.dynamobim.com/uploads/short-url/efSeBmYZuRLv9epOcMdHNagnCCk.dyn) (45.4 KB)

---

<div class="post-metadata">

**Author:** ![Stephen\_Blackburn](https://avatars.discourse-cdn.com/v4/letter/s/3d9bf3/32.png) [@Stephen\_Blackburn](https://forum.dynamobim.com/u/Stephen_Blackburn)\
**Post date:** [March 5, 2018, 7:31pm UTC](https://forum.dynamobim.com/t/dynamo-script-to-write-area-to-excel-by-room-name/19632/10 "2018-03-05T19:31:43Z")

</div>

OK - thanks for the help, good start for me.

---

<div class="post-metadata">

**Author:** ![Stephen\_Blackburn](https://avatars.discourse-cdn.com/v4/letter/s/3d9bf3/32.png) [@Stephen\_Blackburn](https://forum.dynamobim.com/u/Stephen_Blackburn)\
**Post date:** [March 7, 2018, 11:22pm UTC](https://forum.dynamobim.com/t/dynamo-script-to-write-area-to-excel-by-room-name/19632/11 "2018-03-07T23:22:29Z")

</div>

Hello - Maybe one more hint? When I run your script, it separates the rooms into their different departments, but at the end it produces a list of department names (like “Sound Room” or “Practice”). Isn’t this just a list of names, with the indexing no longer attached to a room? Or is there a way to then tie this back into the room (and its area)?  
I have also attached another (#3) where I added some nodes at the top (in orange) that take what you’ve started, and produce a list of room with their dept. names and areas. Not sure if this helps, though.  
Thanks again.  
Steve[filtering rooms by department and level # 3.dyn](https://forum.dynamobim.com/uploads/short-url/5OeYJccyR1MDvpAHAesqtsWt2GL.dyn) (43.3 KB)

---

<div class="post-metadata">

**Author:** ![simon\_murphy1](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/simon_murphy1/32/101536_2.png) [@simon\_murphy1](https://forum.dynamobim.com/u/simon_murphy1)\
**Post date:** [March 8, 2018, 7:35am UTC](https://forum.dynamobim.com/t/dynamo-script-to-write-area-to-excel-by-room-name/19632/12 "2018-03-08T07:35:34Z")

</div>

The output of the python node are the rooms.

---

<div class="post-metadata">

**Author:** ![Stephen\_Blackburn](https://avatars.discourse-cdn.com/v4/letter/s/3d9bf3/32.png) [@Stephen\_Blackburn](https://forum.dynamobim.com/u/Stephen_Blackburn)\
**Post date:** [March 8, 2018, 2:02pm UTC](https://forum.dynamobim.com/t/dynamo-script-to-write-area-to-excel-by-room-name/19632/13 "2018-03-08T14:02:42Z")

</div>

OK, thanks
