Robotic Process Automation (RPA)

 View Only

 Delete a row in a Excel-File

Michael Peinsipp's profile image
Michael Peinsipp posted Wed November 26, 2025 11:01 AM
Hello,

I want to delete the last row from an Excel file. There must be a simple way. If I use `excelGetTable`, then delete the row and write it back with `excelReport`, the date and time formats are lost.

Does anyone have experience with this

Thanks Michael
Jan Roger Gerbig's profile image
Jan Roger Gerbig

Hi Michael,

I think it could be helpful for others if you maybe could attach a code snippet of your current approach.

I talked to a colleague and we came up with two ideas:

Option 1 (Get around formatting issues, because you write in the original excel):

  1. Read out the Excel into a data table
  2. Inside this datatable look for the last row that has the information that you want to delete (https://www.ibm.com/docs/en/rpa/23.0.x?topic=base-data-table)
  3. Use the "Set Value in Excel" command with an empty string as a value or leave out the value entirely as its optional in this command. Use this on the original excel. That way formatting should be not touched and you just set the row to empty (https://www.ibm.com/docs/en/rpa/21.0.x?topic=office-set-value-in-excel)

Option 2 (manually format dates before writing datatable to file):

  • Use the same approach that you already tried, but format the date values manually before writing them back to a excel file

Hope this helps :)

Michael Peinsipp's profile image
Michael Peinsipp

Hi Jan,

Thanks for your reply.

I tried it over template, create new files, ... but it didn't work.

So I did it now with Excel Shortcuts over the sendkey command. This way worked.

kr, Michael