How to get Cell reference or Cell Number along with cell value from datatable

Hello,

I am trying to get the cell reference for which I am getting value in For Each activity. Ex - If I get value from C2 cell then same time need to get Cell reference or cell number ie. “C2” also.
I have done below activity but not getting output.

image

@nilesh.mahajan Use can use loop up data table to get the index number

May I know are you looking for any specific value in the data table

hey

check this

dt.Rows.IndexOf(CurrentRow).ToString

regards

Hello Fernando,

Thanx for reply, I have tried this already which gives me 0 (Zero) as output for each iteration.

hey

its working

it returns the index from each cell correctly

regards

@nilesh.mahajan Its giving as zero because you might be keeping getting that index value within the for each of CurrentRow.ItemArray . Try to get that index within the for each of Got_it_Template_Dt

Hello,

Actually my requirement is to get the cell reference/Cell Name like A2, B2 for which I am getting value from data table.

Ex. If Item.Tostring giving me output as “ABC” then I need the same cell reference as A2 because "ABC in A2 column.

image

then B2 need to show along with “xyz” because it is in B2 column
image

@nilesh.mahajan , Here A2 Indicates that it is the A Column and 2nd Row.

To Get the Row Index, We can use the index Property from the For Each Row.

As your Workflow uses another For Each Activity to loop through the current row’s values, we should be able to use it’s Index to get the Column Name.

In the Message Box, Use the Below Expression and Check if it gets you the Column Name :

UiPath.Excel.Helpers.ExcelUtilities.ConvertColumnIndexToColumnLetter(idx+1)

Here, idx is the index value from the For Each Activity

Let us know what is the outcome

so you can filter if the value matches, then get the values from the new dt

regards

@nilesh.mahajan Did you try with this . For each row in data table activity has some property called Index

index and cell reference
Is this the output you want?

Yes, I want index and cell reference.

For “Cell A”, I hard code the cell reference.
Im not sure if the Excel current cell name is able to retrieve.