Collate data by sheet number - for sheet creation script

I’m trying to make a sheet creation script that can pack an arbitrary number of views onto a sheet. Various parameter values are read from excel, and then applied to the newly created sheets/views. I already have a working script that can pack a single view onto each sheet, but to pack multiple views, I must organize my data into sublists.

Each row in the excel file represents either a view, or a sheet with no model views on it (such as a symbol sheet). I need my script to automatically collate all the data for rows that have a matching sheet number.

So, if my excel file contains 2 rows that both have “M104” in the “sheet #” column, all data pertaining to those views should be grouped together under sublists for each parameter:

Does anyone know how to organize lists this way?

Not sure if this is what you want, but please check out the attched file.
Grouping.dyn (13.6 KB)

Thank you @harilalmn!

That solved my problem perfectly. I expanded on your solution so that now I can input the sheet # and parameter name, and a list of the parameter values is returned:

You are welcomed…