Col1 and col2 concatenation with header

Team,

I am having column1 and column2 with some values. Would like to bring the third column by concatenate col1 and 2 with header headerexcel with headers

**was able to do the concatenation of 2 strings but not with headers

Hi @KavithaManivel,

As you always know the headers are constant, after concatenating the strings you can make the headers constant and concatenate with the concatenated strings.

not clear anil. In column 3 in each cell while doing concatenation i want header too.

@KavithaManivel
As @anil5 mentioned headers will always be same.
You can make your concatenated string like that
“Column1”+row(Column1). ToString+“Column2”+row(Column2). ToString

Oh k got it.

Thanks anil

@KavithaManivel ,

If you doesn’t know the column names in the starting then, you can get by following below steps.

  1. Read Excel.
  2. For each , for each item in DT.columns and argument type is system.data.datacolumn
  3. Now the item from above for each has column name.
  4. Append column names, now you have a string with 3 column names, now split by space and take 0th index and 1st index to get column1 and column2 and append with your strings.
1 Like