Vrishchik
(Naveenkumar Shivaraju)
April 5, 2023, 11:48am
1
Hi All,
I need to concatenate the column values in to a string and need to write into an cell.
For example below is the excel column value.
Currentrow(“Location”).tostring
Location
H
L
M
O
J
the final output should be “H,L,M,O,J”
@ppr
@Yoichi
@Nithinkrishna
@Gokul001
@vishal.kp
@supermanPunch
@ushu
Hi @Vrishchik ,
Could you try the below Expression :
String.Join(",",DT.AsEnumerable.Select(Function(x)x("Location").ToString))
Here, DT
is your Datatable variable
4 Likes
ushu
(Usha kiranmai)
April 5, 2023, 12:04pm
3
Hi @Vrishchik - Try below steps
Read the excel data to data table
Take Assign activity and apply below exp
Variable of type String Output = String.Join(","c,DT.AsEnumerable().Select(function(x) x(0).ToString))
Change the column index value according to your input, col1 - x(0), col2 - x(1)…
Use write cell
activity to write the comma separated values in the Output
variable
1 Like
Vrishchik
(Naveenkumar Shivaraju)
April 5, 2023, 12:09pm
4
This worked perfectly for me but I need to write inside the cell value C2.
But it is writing the same value into multiple cell value.
I am passing the value inside the for each row loop
@Vrishchik ,
You do not need to use For Each Row
activity if the goal is to achieve writing the value to a particular cell.
You can remove the For Each Row
Activity if you were using that for this sole purpose only.
Else just place the Write Cell
Activity outside the For Each Row
Activity with the Expression provided in the previous post.
Vrishchik
(Naveenkumar Shivaraju)
April 5, 2023, 12:17pm
6
It is dynamic like it has to write c2, c3,c4 etc
Jithesh_R
(Jithesh Karkera)
April 5, 2023, 12:19pm
7
@Vrishchik ,
Can you please confirm how is your input .
Is it like this
Or this :
Regards,
1 Like
Vrishchik:
the final output should be “H,L,M,O,J”
@Vrishchik ,
Does it need to write the Same data in multiple cells ? Or do you have different data to be written for each cell ?
If Different data, then we would need to understand your total requirement.
From the initial requirement, you did mention only the Concatenation part and writing the value to an Excel Cell.
Vrishchik
(Naveenkumar Shivaraju)
April 5, 2023, 12:22pm
9
I do have different data, Just I took an example
Hi @Vrishchik ,
Greetings
It would be helpful if you can perhaps share your input Excel file?
Regards,
system
(system)
Closed
April 8, 2023, 12:23pm
11
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.