How to bypass empty cells in the row when writing to Excel?

Hello

I‘m having a problem when exporting to Excel from Revit.

Little explanation before getting to my problem. My Duct fittings are made from 2 to 3 separate pieces.

For example. Elbow has small part of straight duct before and after the bend. All the fittings are made in the same manner. See below:
image

Here lies the problem. The thing is when I’m exporting Duct fitting (elbows, reductions, etc.) to Excel my Dynamo script wrights down the results in a way which doesn’t respect that the fittings are made from more than one piece.

For better understanding the problem I’ve made a print screen of excel file “Actual result”.
There are empty cells in the same row as the result. Probably problem lies somewhere here.


I’ve also made a mockup in excel “How should table look like”.

Here is my scipt I’m working on.

Evidently I don’t have good understanding how list flatten and list transpose works.

I’m attaching the scipt if someone have time to dive into the problem and give me some help.

Thanks to all in advance.

N-V1-Volume_Surface_Poids-Gaine_Raccords.dyn (199.2 KB)

1 Like

You’ll have to include blanks in your dataset before exporting to Excel. You can count the number of pieces for each group of fittings and add blank rows to accommodate for the total needed.

There’s quite a few ways to solve this one… I think sorting and grouping by function is the key here, as you’re trying to associate the order of elements by a common parameter (elbow #)

I’ve made a mockup which achieves this from a shuffled data set:

Mockup

See below and attached for the script and method I used to arrange the data.

Sample.dyn (52.7 KB)

Thanks for this. I didn’t respond because I didn’t have time to test it. Ill give a feedback as soon as possible.