How to convert a table to a single line with datas being separated by comma

Hello there! I want to convert the following data from CSV:

X
Y
Z

to X,Y,Z in CSV file. Please help!

for each row that column. assign that item into a variable. and create a ‘main’ variable and overwrite the first one.

@vishnunair341

above data is present in single cell or separate cell?

Hi @vishnunair341

Refer this:

(Concatenate rows into single string)

1 Like

In separate cells.

@vishnunair341 After reading csv try below code.

String str  = String.Join(",",(From row in dt.AsEnumerable() select 
                    row("UrColumnName")).ToArray(),0)

where dt is datatable variable which is output of read csv activity

1 Like

Thank you very much for your response. The code is working for data extract from the csv. But the issue with me is that, the column name is dynamic. My process is to generate data from “S2:S7” for different csv’s, each having different column name. Can you provide me a code which does not require the column name to be filled and just the data table.

I will show you an example.

For csv1,
columnname1
A
B
C

For csv2,
columnname2
X
Y
Z
Similarly I have to extract many csv’s, each having different column name. But all the csv have my required data in S2:S7 cells.

@vishnunair341 instead of columnname use index of column if all excel contains columns at same position

1 Like

Thankyou @Manjuts90. But instead of using the index, I edited the column name with a standard name for all the csv’s. In this way, I can use the same column name for every process.

2 Likes