How to Merge 2 columns into 1 column with a space

I need to merge the column ‘FirstName’ and ‘LastName’ into a new column

image

Ouput:

image

Hi @lomarnash643

Read range : Read the data into datatable

Add data Column: Use add data column activity and add column ‘Name’

Use Assign activity as below

DT.Columns(“Name”).Expression = “Trim([firstName]) + ’ ’ + Trim([lastName])”

Use Write Range Activity

Cheers…!

@lomarnash643

use read range for reading the first excel and create output as dt1

use build datatable activity and create two columns as Name, Address output as dt2

use assign activity and pass the below expression

dt2=dt1.asenumerable.select(function(r) dt2.clone.loaddatarow({r(“First Name”).tostring.trim+" "+r(“Lastname”).tostring.trim,r(“Address”).tostring},false)).copytodatatble

at last use write range workbook activity to write back to excel

hope this helps

@lomarnash643

if you face any issues refer the below code

Sequence1.xaml (9.4 KB)

dt1.AsEnumerable.Select(Function(r) dt2.Clone.LoadDataRow({r(“First Name”).ToString+" "+r(“Lastname”).ToString,r(“Address”).ToString},False)).CopyToDataTable

1 Like

Hello

Take a look here

Cheers

Steve

1 Like

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