How do i read one cell from a spreadsheet in excel?

Hi,

how do i read one cell from a spreadsheet in excel?
I did read range before.
Now i want one cell in one range.

1 Like

Read Cell activity does it for you.!

2 Likes

@sylles91, If you are using Read Range activity then you have DataTable variable to loop through. you can access any value in row - column combination. Alternatively you can use Read Cell activity and specify specific cell address to read value as mentioned by @UiJack. In that case you don’t have to use Read Range activity. Hope that clarifies :slight_smile:

1 Like

but how do you get access? I have no idea how to get started. except read cell.
I want to get only one value from the column

1 Like

Ok no problem. Just following up from @Bhavik_Solanki point. Once you have used the read range activity to output your datatable. In order to access the values in the columns. You need to use a for each row activity. This will be use to cycle through all the rows. Add your datatable as input for each row. Then to access the values in the datatable, use item(0).toString. 0 will get you the first column in the datatable. You can then show this result using a message box or write line activity.

I hope this helps. :grin:

“use item(0).toString. 0 will get you the first column in the datatable. You can then show this result using a message box or write line activity.”

I don’t understand “use item(0).tostring”. I have for each row for my datable, but how I can read one cell?

1 Like

Fine
—there are two things to be considered
If we want to read a cell and if we know the exact position of that cell in the excel like A12, C20 something like that then we can use READ CELL activity where mention the cell range as “A12”
Or “C20”, the cell position we know
So that we can get the value stored in a variable of type string

The second one is if we don’t know the cell position that we want to read but if we know the column then we can go through each row in that column and thus we will get each cell value of that column
For that use READ RANGE activity and get the datatable as output
-then use FOR EACH ROW activity and pass the above datatable variable as input
—inside the loop use a MessageBox activity and mention like this
row(“yourcolumnname”).ToString

This will display each cell value in that specified ColumnName

Cheers @sylles91

1 Like

Ok no problem. I will explain more. In your for each row activity, you have for each (variable name) in (datatable). You want to write (variable name).(position of column).tostring.

So for example to get the first column in my example. It would be write line activity with row(0).tostring inside the for each activity.
image

I would that helps man. :slight_smile:

this is still giving you the entire column. I believe @sylles91 is asking to read just one cell- i.e. A1 or B3. Just one cell NOT one column. @Palaniyappan message explains it how to get the cell value.

Thanks @Palaniyappan…I was looking for the same answer since I am completely new to this myself.

Regards

Asha