To concatenate 2 values in excel using LINQ

Hi all,

I want to concatenate 2 values in a excel.
Below is the format

Col1. Col2. Col3. Col4. Col5. Col6
AA. 1. a. 11. 21. Alpha
BB. 2. b. 12. 22. Beta
CC. 3. c. 13. 23. Gamma
DD. 4. d. 14. 24. Delta
EE. 5. e. 15. 25. Charlie

I want to create another column called col7.

The value I want the values in it as:
a.-Alpha

Is there a way I can achieve it through LINQ?

Any idea?
Thanks in advance!

@ppr @Palaniyappan any idea?

Hi, try this:

dt.AsEnumerable().Where(Function (row) Not String.IsNullOrEmpty(row(“Col3”).ToString) and Not String.IsNullOrEmpty(row(“Col6”).ToString)).ToList().ForEach(Sub (row) row.SetField(Of String)(“Col7”, row(“Col3”).ToString+ “-” +row(“Col6”).ToString))

I used this within an invoke code activity where dt is a datatable set as in/out parameter. Then I used a write range in order to write the entire dt in excel. (keep in mind you will need to make sure “Col7” exists)

@Ray_Sha1
have a look here on the second part on how it can be done with the expression setting of a datacolumn: