Transpose execl using LINQ query


I don’t want to use any activity. Want to achieve it using LINQ.
Any idea?

Thanks in advance!

Have a look for starting

1 Like

Hi @ppr,

Thanks for sharing it.
It’s not what I’m trying to do.
I want to try simple transpose using LINQ.

Yes as menioned it is introducing on the main building blocks like

  • setting up dynamic the columnstructure
  • collecting values and tanspose it

Maybe you share some more detauils (requirement, sample data) with us. Based on this we can give you a more case related help

Hi @ppr,

For example- in my excel sheet, I have


    1. 1
    1. 2
    1. 3

I want to transpose it.
I’ve achieve it using activities and it’s takes a lot of time for big reports.
Using LINQ is there a way to achieve this?

Thanks in advance!

please in input, expected output pattern. Thanks

Hi @ppr

The input sheet is

The output sheet must look like



we are preparing the target Column structure dynamicly as following:

then we can execute follwoing LINQ:

(From x In Enumerable.Range(0,dtData.Columns.Count)
Let ra = dtData.AsEnumerable.Select(Function (d) d(x)).ToArray
Select dtDataResult.Rows.Add(ra)).CopyToDataTable



Hi @ppr,
Getting a lot of errors.

Is it possible to share the xaml?

Thanks in advance!

find starter help here:
Transpose_Demo_LINQ.xaml (8.9 KB)

its better to tell us which errors you got, as we can help on details

The shared xaml is not similar to the screenshot.
Following the screenshot, getting error like- assign- input array is longer than the number of columns.

This is what I’m Facing now.


check from above on how the columns structre is set up dynamicly.
exception comes from a mismatch of available datacolumns and added values from the add datarow

I updated XAML above, was copying another case but is now correct one

@ppr thank you.
Works well

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.