Add row into single variable

Hi Team,

I am using excel which contain column name “marks”. I am using for each row activity to iterate to each row.
My requirement is, I need to store all values from column “Marks” into the single variable using “,”
Eg. 10,20,30
How to do that.

Hi @sshitol,

Use excel read column activity, this will give you result as IEnumerable datatype.
Then using string.Join(",", yourEnumObject") will give your the result as you are looking for.

Here yourEnumObject is my out value of read column activity.
If you do not need the column header then read from A2 or B2 instead of from header row.

Is it possible using read range activity

Hi Greetings!

Please use this in assign activity,

yourStringVariable = dataTable.AsEnumerable().[Select](Function(x) x(“Column1”).ToString()).Aggregate(Function(a, b) String.Concat(a, “,” & b))

Thanks!

Yes, if you are reading the excel as datatable then, in the string.Join pass like this.

string.Join(",",yourDataTable1.AsEnumerable().[Select](Function(r) r.Field(Of String)("Marks")).ToArray())

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