Readind data from excel returns 500 rows.. even though i have data in just 14 rows

Hello

When i do read range and print the row count, i get as 500

where as this sheet as 14 rows.

what am i doing wrong here?
Is it because of the excel template its returning 500 rows?

I just want the row count till the cell where the values are filled and save the data till that row in DT.
Thank you

Hi @hansen_Lobo

Can you make sure that rows between 15 to 500 doesn’t contains any data?

Regards
Sudharsan

Hi @hansen_Lobo

Can you try to delete the rom start from 15 to 500 and try to Read the file?
Can you create the new excel file and check it?

Fine after reading the datatable use a assign activity and you can use the below Linq query to delete rows which has empty cells in a datatable
Use assign activity and assign the below query to a new Datatable.

dt = dt.AsEnumerable.where(Function(row) row.ItemArray.All(function(col) not string.IsNullOrEmpty(col.ToString))).CopyToDataTable

Hope this helps

Cheers @hansen_Lobo

@hansen_Lobo

1)If you want to extract only the rows with actual data in UiPath and ignore any empty rows or rows beyond the data.

input_datatable = YourDataTableVar.AsEnumerable().TakeWhile(Function(row) row.ItemArray.Any(Function(cell) Not String.IsNullOrWhiteSpace(cell.ToString))).CopyToDataTable()

Replace input_datatable with the variable name you want to assign to the extracted DataTable.

cheers…!

Hello @hansen_Lobo
Try this
By using the Filter data table you can filter the empty data in the data table