Excel column want to merge

Hello all, here in excel I want to merge the column from A1:D2 and want to write in one cell

Try with this custom component

Cheers @dhanashree22

1 Like


take one build datatable and mention the colmname as ColMerge

1.read excel by using the read range
2.for each in datatable mention your dt out put.
3.multiple assign activity. in first assign create 1 variable called Col1 read the first column like this Row(“Columname”).tostring
4.repeat 3rd step for 2 times for Col2 and Col3 respectively.
5.take another assign activity and create a variable ColMerge=col1+col2+col3
6.Add data row. mention the datatable and in the properties panel in the array row{ColMerge}
this will update the data in to your build data table.

if you wants to do this in excel use write range and mention the range as E1.


hello here I get the error In For Each that you cannot implicitly convert type "System.data data table to "system.collection.IEnumerable. An explicit conversion is exist.
what should I do?
I mention the for each item In BuildDT


Can you try the following steps?

First, use ExcelapplicationScope and ReadRange with the following settings.

AddHeaders: Off
Range : "A1:D2"
DataTable : dt (Make this as DataTable type in advance) 

Next, use the following expression in Assign activity

s = String.Join(vbLf,dt.AsEnumerable.Select(Function(r) String.Join(" ",dt.Columns.Cast(Of DataColumn).Select(Function(c) r(c).ToString))))

Finally use WriteCell activty with the following setting in ExcelApplicationScope

Range : Address you want to write to
Value : s


the name Vblf does not exist in the current context
error come in assign activity


Can you try to replace vbLf to chr(10) ?

Or do you use C#? the above is for vb.



Alright. As you use C#, I’ll rewrite for it.


how to use c# here

I want
head 1| head2
abc xyz

I want op as head 1: abc , head 2 : xyz


Can you try the following expression? This is for C#.

s = String.Join(",",dt.Columns.Cast<DataColumn>().Select(c=> String.Join(":",dt.AsEnumerable().Select(r=>r[c].ToString()))))


Ok Thanks a lot. It work. But it works with heading values . I want
Heading: value, heading : value. what things to be add in that expression in assign activity


Do you mean you need to add extra whitespace after colon and comma?
If so,can you try to modify "," to ", " and ":" to ": " in the expression.


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