Excel search value and write set.parameter

Hi, I’m trying to retrieve the price of an item (from an Excel file) and write it to a field in a bill of materials.
example: if in revit: type = “Stainless Steel 304L - Stitching” AND Diameters = “65.0 mm”, then write in “cout_unitaire” the value from the excel file.
then write the value from the corresponding excel file in “cout_unitaire”, i.e. 69€.

I am reading the list of “diameter pipes” in the excel file correctly
list.GetItemAtIndex : 0=20; 1=25 … 5=65 ; 6 = 80 etc…

I read the price list in the excel file correctly (€)
list.GetItemAtIndex : 0=47; 1=48 … 5=69 ; 6 = 81 etc…

I also read the list of my “diameter pipes” parameters carefully
Element.GetParameterValueByName : 0 = Ø80 mm ; 1 =Ø80 mm; 2 =Ø80 mm; 3 =Ø65 mm; etc…

from now on I’m dry…
how do you get the price value from the excel file (eg: line 5 = €69
and write it (Element.SetParameterByName) in the project list on all the lines where the diameter 65 is found ?

thank you in advance for your help
A very happy festive season

I’ve made some progress…
I can now retrieve the price list

but I have an error on my output block…

I can’t convert my list into a value
une idée ?

1 Like

@jean-marc.percebois ,

does the number of the elements match the count of the values? 18
is it a instance parameter that you fill?
what does the warning say ?

KR

Andreas

Instead of going from excel to many elements, try building a nested dictionary of the materials/types/sizes and pull each value from there. The dictionary can be built directly from the excel data, and then you can sequentially pull the values needed for each element.