Set Parameter value from excel

My excel has a column for house numbers,its corresponding post code and house id. I’m trying to compare those values from the values fetched from revit parameter named ‘house number’ and ‘pincode’. I want to set the corresponding house id from Excel to the room in Revit where house number and pincode is equal to the combination of values of columns in Excel. Have attached the Excel and the code.

import clr
clr.AddReference(‘ProtoGeometry’)
from Autodesk.DesignScript.Geometry import *
clr.AddReference(“RevitAPI”)
clr.AddReference(“RevitServices”)
clr.AddReference(‘RevitNodes’)
import Revit
clr.ImportExtensions(Revit.Elements)

import Autodesk
import RevitServices

from Autodesk.Revit.DB import *
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc=DocumentManager.Instance.CurrentDBDocument
#rooms=IN[0]
collector = FilteredElementCollector(doc)
rooms = collector.OfCategory(BuiltInCategory.OST_Rooms).ToElements()

List of list of coloumns “House Number”,“Zip code”,“Bag ID”

room_housenumberExcel=IN[1]
room_housenumber=
room_PostcodeExcel=IN[2]
room_Postcode=
room_bagidExcel=IN[3]
room_bagid=
output=
TransactionManager.Instance.EnsureInTransaction(doc)
for room in rooms:
for param in room.Parameters:
if param.IsShared and param.Definition.Name == ‘Huisnummer’:
room_housenumber.append(room.get_Parameter(param.GUID).AsString())
if param.IsShared and param.Definition.Name == ‘Vabi_BAGpandID’:
room_bagid.append(room.get_Parameter(param.GUID).AsString())
if param.IsShared and param.Definition.Name == ‘Vabi_BAGpandID’:
param_BagPandId=room.get_Parameter(param.GUID).AsString()
for j in range(len(room_housenumber)):
for k in range(len(room_housenumberExcel)):
if (room_housenumber[j]==room_housenumberExcel[k]) and (room_Postcode[j]==room_PostcodeExcel[k]):
param_BagPandId.Set(room_bagidExcel[k])

TransactionManager.Instance.TransactionTaskDone()
OUT=output

Try searching the forum for some tips. There are plenty of answers already out there. Dictionaries are probably your best option here.

Okay. Just found that i was using get_Parameter instead of LookupParameter for type parameters. Thanks for your quick response :slight_smile: