How to take one complete excel column into a variable

Hello Could some please help on How to take one excel/CSV column in a variable.?

@ks185332 You have Get excel column option in uipath and output it to a variable

Hi @ks185332,
You have an Activity Called Read Column in Uipath
on that Activity you need to Specify the Column name like “A1”
or Else

By using Read range Activity we will get output as Data Table
By iterating that Data Table using For each Row we get all column Value or Particular Column Value with help of Column Header then assign that value in list variable
Regards,

I wanted to give a condition llike in the mail subject contains one string and list variable.
can you please help me with that condition.

@ks185332

1.Use read range, and read your excel sheet to a datatable dt.
2. use this query and assign it to a list of strings

(From p in dt.AsEnumerable
select Convert.ToString(p.Item(“column_name”))).ToList

Replace your column name in the place of column_name

Regards,
Mahesh

@MAHESH1 what is ‘p’ ?

@ks185332
That is just like each row in datatable. you need not to change anything other than your datatable variable and column name

Regards,
Mahesh

@MAHESH1 I have given my condition is ‘mail.Subject.Contains(“Approved” and qLiD)’
qLiD Assigned to (From p In Dt1.AsEnumerable
Select Convert.ToString(p.Item(“QLID”))).ToList please correct me…

I need like subject should contains Approved and one of the row in that specifed column from datable.

@ks185332

Should your column conatins approved if so after extracting column give this condition list.Contains(“Approved”) then (your requirement)

Regards,
Mahesh

Hi @ks185332
Try with Data Table select Query
DataTable.select(“ColumnName=‘Value’”)
datatable.select(“ColumnName=‘Approved’”)
Output of the above command as collection of datarow
by iterating that you get your required column
Regards,

could you show this in an example file? I’m not sure I get it the way you mean it

@AnniekJ

As u said earlier this might help you
List A= (From p in dt.AsEnumerable
select Convert.ToString(p.Item(“column_name”))).ToList

Replace your column name in the place of column_name
str a=mail.Subject.ToString
List B=str a.Split({" "},stringSplitOptions.RemoveEmptyEntries).ToList
Now in if condition use like this
ListB.Contains(“Approved”) and ListA.IntersectOf(ListB).Count>0

Iam using intersection to check common words.

Regards,
Mahesh

Hey (From p in dt.AsEnumerable
select Convert.ToString(p.Item(“column_name”))).ToList

we have to use this in for each row activity or assign activity?

I am confused with p here

Assign Activity you have to use

that I know , but the expression will start from
like this - dt.asEnumerable

P is nothing but a character , you can use any character here instead of p but make sure

if you are using any other character then change everywhere
ex : (From x in dt.AsEnumerable
select Convert.ToString(x.Item(“column_name”))).ToList

thanks this works, but this also reading the blank values in the column

my column has only 3 values , but this collection variable is taking 7 values from the column the next is null values