Rename elements using Excel Data Sheet and Dynamo

Hello everyone

I’m trying to build a dynamo script that can rename elements using an Excel Data sheet (like a mutiple find and replace tool).

I’m using for that the String.ReplaceMultiple from the clockwork package.
Here is the script that I came up with :

Any idea as to why it’s not working ?
Thank you in advance for your help,

Hopefully this helps, it will rename the families:



import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
elements = UnwrapElement(IN[0])
names = IN[1]

TransactionManager.Instance.EnsureInTransaction(doc)
for i, n in zip(elements, names):	
		i.Name = n
TransactionManager.Instance.TransactionTaskDone()

OUT = 0

We can’t see any of your node inputs/outputs. We can’t tell you what’s happening if we can’t see the data. What are your searchFor and replaceWith inputs? The node says it’s succeeding (and it’s working for me) so I’d guess there’s something wrong with your inputs.

For interface through excel, I would use a different approach to the naming.

Start by exporting your families with their element ID, ensure your columns in excel is via ID and family name.

Then, use the IDs to obtain the elements and rename it with clockwork as you have done so.

Pretty sure you can combine your parameter lists from different sheets into one worksheet.