How could I get the last value of a column header in Excel based on the filled data?

How could I get the last value of a column header in Excel based on the filled data(real data which exists in the excel file)?
Hello.

The process always exports an excel file and this file It’s supposed to add some number of columns and values.

I’m using an excel data scope and I want to read a range of values in an Excel file…, but The question is, how could I calculate the last column header? How would I know about the last value filled in that column to put in the range value? Like this one

A1:(Xcolumn)(unknownvalue)

I’d like to get ideas about how to get LastValue based on the last column and its last value, thanks

Help, please. Thanks.

Hi @pprin001,
I am unclear with the question, are you trying to read the entire sheet into a data table, in which case you don’t need to provide any range

If you want to get the count of either the last row or column, then use the datatable_variable.RowCount or datatable_variable.ColumnCount properties.

Let me know if this solves your issue

Thanks,
Nishant

Hi nishant. For example, I have an excel file with
A,B,C as column headers:
1 2 3
4 5 6
7 8 9
with values like that.

Then i put a read range excel function and put ("A3:??), but I dont knot the last column letter header because it might change.(for this example is C but it might change due to the scenary of my process).

The same happens with the last value in C3 which is “A” but it might change if another coworker adds more information. I need to put that "read range " based on that.

Lets say that tomorrow the file changes to this:

A B C D E
1 2 3 p q
4 5 6 r s
7 8 9 t u

Readrange(A3:??) Is that possible i mean robot could get the columb header letter and the last number of that column (E3). Its the number 3 but how?

Hi nishant. For example, I have an excel file with
A,B,C as column headers:
1 2 3
4 5 6
7 8 9
with values like that.

Then i put a read range excel function and put ("A3:??), but I dont knot the last column letter header because it might change.(for this example is C but it might change due to the scenary of my process).

The same happens with the last value in C3 which is “9” but it might change if another coworker adds more information. I need to put that "read range " based on that.

Lets say that tomorrow the file changes to this:

A B C D E
1 2 3 p q
4 5 6 r s
7 8 9 t u

Readrange(A3:??) Is that possible i mean robot could get the columb header letter and the last number of that column (E3). Its the number 3 but how?

@pprin001 I got your problem

Let me explain range.
When we use range as “A1:C3”
It means we are getting specific block of data.
But when you don’t know about data.
Then we are using
“A1:” it will read end of data and its flexible

1 Like

Hello @pprin001 Welcome to Uipath Community
In Read range activity , you have to give starting range of Excel file and the End of column no need to give.
Because, i will reads entire data from A1, If you give A3 it reads entire data from A3 to end of workbook
image

Regards,
Gokul Jai

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.