How to take one complete excel column into a variable

excel
csv

#1

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


#2

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


#3

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,


#4

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.


#5

@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


#6

@MAHESH1 what is ‘p’ ?


#7

@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


#8

@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.


#9

@ks185332

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

Regards,
Mahesh


#10

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,


#11

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


#12

@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