How to store multiple row values present in excel into a variable/argument?

Hello. I am working on a process and im trying to store multiple row values present in a column (in excel) into a single variable or an argument inside the UiPath Studio Community Edition.

how to do this?

@Moola_Kommalu,

If you need to get a column value alone, then you can read the excel as a datatable using read range. Then you can convert the needed column value into an array of string datatype as follows

dtvariable.AsEnumerable.Select(Function(r) r("columnname").ToString.Trim ).ToArray
1 Like

Should i do this step using an assign activity?

I used Assign activity and assigned dtvariable.AsEnumerable.Select(Function(r) r(“columnname”).ToString.Trim ).ToArray to the sub_ variable.

now when I’m trying to use the keywords present in the column(excel) to match the email subject in outlook mail, I’m getting this error.

image

sample_1.xaml: Compiler error(s) encountered processing expression “item.Subject.Contains(sub_) Or item.Body.Contains(body)”.
Overload resolution failed because no accessible ‘Contains’ can be called with these arguments:

  • ‘Public Function Contains(value As String) As Boolean’: Value of type ‘1-dimensional array of String’ cannot be converted to ‘String’.*
  • Extension method ‘Public Function Contains(value As Char) As Boolean’ defined in ‘System.Linq.Enumerable’: Value of type ‘1-dimensional array of String’ cannot be converted to ‘Char’.*
    Overload resolution failed because no accessible ‘Contains’ can be called with these arguments:
  • ‘Public Function Contains(value As String) As Boolean’: Value of type ‘1-dimensional array of String’ cannot be converted to ‘String’.*
  • Extension method ‘Public Function Contains(value As Char) As Boolean’ defined in ‘System.Linq.Enumerable’: Value of type ‘1-dimensional array of String’ cannot be converted to ‘Char’.*

sample_1.xaml: Compiler error(s) encountered processing expression “item.Subject.Contains(sub_) Or item.Body.Contains(body)”.
Overload resolution failed because no accessible ‘Contains’ can be called with these arguments:

  • ‘Public Function Contains(value As String) As Boolean’: Value of type ‘1-dimensional array of String’ cannot be converted to ‘String’.*
  • Extension method ‘Public Function Contains(value As Char) As Boolean’ defined in ‘System.Linq.Enumerable’: Value of type ‘1-dimensional array of String’ cannot be converted to ‘Char’.*
    Overload resolution failed because no accessible ‘Contains’ can be called with these arguments:
  • ‘Public Function Contains(value As String) As Boolean’: Value of type ‘1-dimensional array of String’ cannot be converted to ‘String’.*
  • Extension method ‘Public Function Contains(value As Char) As Boolean’ defined in ‘System.Linq.Enumerable’: Value of type ‘1-dimensional array of String’ cannot be converted to ‘Char’.*

the output is a array which contains value of all rows in a column.

loop through the array sub_ and then check whether the subject contains the keyword or not.

I didn’t quite understand that. can you please explain?

Can you explain more about this??

I didn’t get any keywords from the sub_ variable. I am getting the value as system.string

add foreach loop with sub_ array string and inside of loop keep the if condition.