How to delete a row in an Excel workbook

Hi all ,
My task is simple . I wish to delete the second row in an Excel workbook . I tried going the " Read Range -> Delete data row -> Write Range " way , but I faced a problem. The workbook is not cleared of data , and when “write range” is used it causes , repetition of data row.
Can someone tell me how to accomplish this task with out datatables. I wish to do this by “Invoke Method” activity.

1 Like

Would writing in a new sheet or file do the trick?

1 Like

That’s a possible solution . If you write the data in a new sheet , you will have to delete the source worksheet though ( I don’t know how to do that ).

Can you help me with both the cases ( if I don’t want to write in a new sheet ) . I also want to learn how to use "invoke Method " activity.

1 Like

Hi Anubhav, another solution would be to use “Select Range” with Range “2:2” and then to use “Send Hotkey” activity where you send Ctrl+"-" which will delete the row in Excel.


Hi all, i tried this, open and select the range works, but not delete the range, do you any idea why not ? worked for you Jan?.

edit: not worked because the send hotkey function, uses the right control, and i am working on a oracle virtual box machine, this uses the right control for oracle shorcuts to operate the virtual machine, so i had to change in preferences the right control for other key like left shift, to release the right control, so uipath can uses now.

thanks BR.

Badita, because "For Each " loop doesnt allow Remove Data row , I used "do while loop "
click the blue link below


You can use invoke code activity

Sheet1= wb.sheets(“Sheet 1”)

After this you can write in excel