Count the number of entries in the Excel sheet and save the number in a counter

Hey,
I want to use a counter to count how many entries there are in the Excel sheet. How do you do that? See picture: The counter should be 10 at the end, since 10 columns are occupied

1 Like

@Maxi_B
have a look on followoing activity
grafik

1 Like

Where are the Activity, I can not find them?

grafik

1 Like

okay Thanks :slight_smile:

1 Like

i testet now and i get a fail… : Source: Find LastRow

Message: The object reference was not set to an object instance.

Exception Type: System.NullReferenceException

my code looks so:

@Maxi_B
similar as we do handle it with the uipath activities there is a excel application scope as well:
grafik

okay thank you :slight_smile:

i testet now the function.
The last row function always gives me the last column of the whole sheet (661) and not, for example, the value 11 because 10 columns are filled

@Maxi_B
often blanks (Leerzeichen) are counted as values

find following alternate starter helps (Use read range to bring excel data to a datatable)

Get_LastValueIndex_1Col.xaml (6.6 KB)

and demo case for a more detailed report on all columns:
GetLastValueIndex_AllCols_V2.xaml (10.9 KB)
e.g.
grafik

Edit: improved the code so use Version 2: the offset of 2 for the Excel range is for the case of add headers is ticked on, otherwise change the offset to 1

2 Likes

hello I have one more question if I adapt it to my part the error is: “AsEnumerable” is not a member of “System.Data.DataTable”. Do I still have to import something?

@Maxi_B
have a look here:

1 Like