Find First/Last Data row values in Excel range for fill range

Everyday one of report need to be amended in a excel sheet as master data. after amendment, few more columns need to populated manually, which i am trying to automate through Ui Path.
I used Find Fast/Last Row activity to find the populated data in a excel sheet. now I want to use Fill range activity to populate the specific values. I need to update at least 9 columns with different values but range remain same.

while doing like this (“K”+Firstrow+" : "+“K”+Lastrow) in Fill range, it showing error. please let me know how I can resolve the error by using rowcount or First /last data row.

@soumya.chatterjee
What is the error?

regards

Hey,

Read this into a datatable and get the row count using: Datatable.Row.Count, which you can use in your above expression.

Thanks

image
while running it shows this error

@prateek.mehandiratta9 can you please explain how can I use row count on the above?

Hi @soumya.chatterjee

when using the Fill Range activity, you need to provide a valid range that follows the Excel column and row format.

The “K+FR:K+LR” range you mentioned seems to be a combination of a column letter (“K”) and two numerical values (“FR” and “LR”) that might represent row numbers.

What do you mean by K+FR?

However, UiPath expects the range to be in a specific format, such as “A1:B10”, where “A1” represents the top-left cell and “B10” represents the bottom-right cell of the range you want to fill.

Regards
Gokul

@soumya.chatterjee

If FR and LR variables then please use like this

"K" + FR.ToString + "K" + LR.ToString

Cheers

FR and LR both variables, Which hold numbers. Like K1 (1=FR) and same for LR.
but i like to know how to place code under range with variables. tried the below but still shows error.

Still shows error.

@soumya.chatterjee

Small correction to syntax…we missed colon and it should be in quotes

"K" + FR.ToString + ":K" + LR.ToString

This should solve

Cheers

Hi @soumya.chatterjee

Check out the image

What is the variable type of FR and LR? I have used string in the below screenshot

Regards
Gokul

Hi Anil,

Thanks man, it solved the issue.

1 Like

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