Search for last row data in excel and write data on the next empty row using StudioX

Hello everyone,

I am trying to find the last row data in excel, skip a line and insert new data in the next empty row - as shown in the image.
There will be empty column in between because I am copying the data from SAP report without changing the format.
I have tried using ‘Find First/Last Data Row’ but it didn’t work.
Please guide me if you guys have any idea. Thank you in advance.

Hi Winnie
you can remove empty row by the help of Filter Data Table
image

and you can use this expression
DataTableVariable.AsEnumerable.Last()(“FRUITS”)

Thanks,

Hello Rounak Kumar,
I don’t want to remove the in between empty row.
But I want to add new data at the new row column 9 (referring to the image shown above).
Is there a way for UiPath Studio X to detect the last row and then add new data to it ?

The expression you provided as shown below is to detect the last row ?
DataTableVariable.AsEnumerable.Last()(“FRUITS”)

Thanks.

Hi Winnie,

You can use DataTableVariable.rows.count
it will give the last row index and then you can increment by 1
i.e DataTableVariable.rows.count+1
you can write value there
Thanks,
Rounak

Hi @Rounak_Kumar1,

Just want to be sure, which activity should I use for this in StudioX ?
I’m currently using ‘Read Range’ activity but it didn’t have any column for me to write the value I want it to be enter.

Thanks,
Winnie

Hey @winne.oo
if you want to write then
you should use write range activity
Thanks