Excel cell extraction

Hi,

I have an excel from which i need to read a particular column and compare if the values exists in another excel sheet X
Each cell have values separated by comma for ex: cell b1 = a,b,c,d,e and i need to compare if a exists in excel X, b exists excel sheet X. How do i split the values separated by comma

IF you want to get the value of a particular cell use get cell activity and to split take one variable of an array of strings

varstring.Split(",".ToCharArray).ToArray()
1 Like

Hey @shreyaank,

After you read the particular cell. Assign in a String Variable (strCellValue).

Now create a new array variable called arrayCellValue.

Now use the assign activity to split the cell value and store it in array value.

arrayCellValue = strCellValue.Split(","c)

Or

Simply use Split String Activity and pass the delimiter (,).

Now all the values are splited by comma and stored in array variable.
You can access the all value by it’s index.
Like arrayCellValue(0). It will return first value in the array.

If you want to check your value(a) Exists in the array?
Then use it. arrayCellValue.contains(“a”) it will return a Boolean output.

TanQ,
Michael Udhaya

Hi @shreyaank
Fine
Kindly follow the below steps that could help you resolve this issue
–use excel application scope and pass the file path of excel A
–read range activity within this scope and get the output variable of type datatable named outdt1
–use another excel application scope next and pass the file of excel B
–use read range activity within this and get the output with the datatype datatable named outdt2
–now use a for each row loop and pass the variable outdt1 and change the variable in for each row loop from row to row1
–inside this use a assign activity like this, in order to split the values in the cell value of column B as you have mentioned, like this
out_cell_array = Split(row1(“yourcolumnname”).ToString,“,”)
where out_cell_array is a variable of type string array
–Then use a for each row loop next to this assign activity still being inside the first for each row loop and change the variable from row to row2. pass the variable
–here use a if condition like this
out_cell_array.contains(row2(“yourcolumnname”).ToString)
this would check is there any value among a,b,c,d,e in the cell of column in B1 in the datatable outdt2 and if this condition gets passed it will go to THEN part of if condition where we can use any activity we want but atlast make sure we use a bread activity in the THEN part atlast, to avoid comparing again even after the match is found

Hope this would help you buddy
Cheers @shreyaank

Cheers @shreyaank

Hey Palani, Do you have a sample XAML for the above activities that you have described?

1 Like