Delete excel sheet data except header

I want to delete all excel data without deleting header

1 Like

you can use filter data table to delete or clear data table and when writing it back to excel make sure you use add headers in property panel

there is no option in filter data table for clear data

Hi
Hope these steps would help you resolve this
—use START PROCESS a activity and pass the filepath of the excel as input to FileName property so that it will open the file in foreground
—now use SEND HOT KEY activity with key as ctrl+home with no element chosen for selector
—again a send hot key with key as down
—another send hotkey with key as ctrl+end
—send hot key with key as delete
—send hot key with key as ctrl+s
—a final send hot key with key as enter

All these send HotKey must be used with only the hot keys and no element should be clicked or selected

This will delete the data except header and it’s more like how we do only with keyboard

Cheers @Gauri_Rawool

@Gauri_Rawool

Use Insert/Delete Rows activity to do that.

But we have to scrap the excel and excel name is dynamic it will affect selector

1 Like

it will only delete number of rows and rows may be decrease or increase dynamically

1 Like

@Gauri_Rawool

Use Read Range Activity to read the data from Excel file and try below expression to get no. of rows into Excel file and pass this count there.

          inputDT.Rows.Count
1 Like

N O we don’t need to scrape or select range as that is what is done by ctrl+home -> down -> ctrl+end
And to delete the records except headers we are using delete

And it doesn’t matter whether the excel file name changes or not as we are not going to select any element for send hot key (that was highlighted in the previous post itself)

This would for any excel file

Cheers @Gauri_Rawool

can you please share the workflow because it is not deleting any data by roe count

not working

1 Like

Are headers always in A-Z 1?
If so use write range A2-Z999 with 0 value.
Then you Will clear everything but headers

@Gauri_Rawool

Could you please show me properties of Insert/Delete Rows activity in screenshot. Need to check once how you passed values to it.

Here you go with a xaml of it wiith same steps
kindly check once the input file before and affter run
sampllee.zip (15.9 KB)

Cheerss @Gauri_Rawool

Hi @Gauri_Rawool,

Here is an activity called "Delete Data"to clear all the data inside Excel.

Regards
Balamurugan.S

1 Like

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