Tranpose columns to row in excel(C# code)

Continuing the discussion from Transpose columns to row in excel (Using C#):

I used this custom activity:

But this works if a column does not have unique values and does not work if all values are same.

I get this error

@wasea Any inputs from your side?

Can someone help me how to transpose columns to row in excel as this custom activity does not meet the requirement.

I referred to this: How To Transpose DataTable – In UiPath – ExcelCult

it is a VB one, i need help with C# one.

Am running into issues here.