Setting multiple parameters in multiple instances from excel

Hello, everyone

My task is to take an excel spreadsheet that has a list of unit selections from a vendor, extract and organize the data I need, and push that information into a set of parameters. After a lot of searching and reading previous posts, I’ve hit a wall.

To this point, I’ve essentially:

  • created a filter to list only the elements I need to push information into
  • formatted the information in the excel into a series of sublists
  • used a dictionary to put the information in the same sequence

The problem is when I finally try to write the information to the parameters. Some of the parameters write, and some don’t. From what I can tell, the parameters that don’t write get removed from the list, and the subsequent value that can write moves up to the next available parameter on the list. The latest error I received states, “The parameter’s storage type is not a number.” I’ve gone through the excel spreadsheet to ensure that the cell format matches the parameter’s; I assume that any parameter formatted for engineering info (non-text) will accept numbers, so I tried to match up text with text and numbers with numbers/engineering values. I’m at a loss and I have a lot of data to compile in Revit.

The snip below shows the end of the script where I’m running into issues. The circled part shows where I checked the pairing between the indices in the excel file and the parameters I want to write to.

Any help you can provide would be great. I’ve attached sandbox files for testing.

Write Eqpm info to Revit (by ID-instance).dyn (78.3 KB)
Write Eqpm info to Revit (by ID-instance) TEST.dyn (65.9 KB)
L03_Reformatted selections 11-7-19 test.xlsx (42.8 KB)

What does your error say? I’m guessing your values were converted to numbers and your parameter is a text parameter from the looks of it.

“The parameter’s storage type is not a number.”

The thing is, I’ve swapped the parameters out for others that use integers or numbers, but it seemed to make no difference.

@Nick_Boyts Are you saying that, even though the values in the excel file might be set to the same format, when the script processes the information, it still converts those values to numbers?

Fortunately there are nodes that convert strings(text) into numbers, and the other way around.
String from Object wil turn everything it receives into text.object or tries to.
There is also a node that tries the opposite. Number from text i think.

Correct. If you’re using Excel.ReadFromFile it even has a boolean to convert all values to strings, otherwise it will try to guess the format.

I tried using a known text parameter and a known integer parameter for the “Unit Size” value, which is just numbers. It would not populate in either one. There doesn’t appear to be a discernible pattern for what’s written and what isn’t since the same parameter will populate for other values, and the placement of values isn’t consistent. I’m also toggling input levels, but I don’t think that’s it.

Impossible to tell without seeing your graph and the error you’re getting in these situations.

I’ve included the sandbox revit file with the equipment I’m trying to push info into, the corresponding XLS file with the data, and the current script in the OP. I’m still trying to work through it. If I find something, I’ll post.

I’m not seeing an RVT.

My apologies. I’ll re-attach all relevant docs here.

Revit file: https://drive.google.com/drive/folders/1Q3mu_e1kwFD8R-dCD7chVTZ5Ar7b5vVs?usp=sharing
Write Eqpm info to Revit (by ID-instance).dyn (75.5 KB)
L03_Reformatted selections test.xlsx (42.8 KB)

Update:

I ended up restructuring the parameter data to match the list count of the number of elements I needed to write to, and it matched up almost all of the parameters. Only thing I noticed that was off so far is the EWTs and LWTs.