Delete 3 top Row In Excel File

Hi,
Does anyone Know how to delete 3 top row in Excel with.out Using hotkey ?
or delete 3 top row with out Opening .xlsx file .
anyone know about this ?

Rookie,
AUPE

@Aupe,

Use Insert/Delete Rows activity. Please find the attached workflow.

Test.xaml (7.2 KB)

Hi,

Use read range and specify range “A3”
This will return entire excel from 3 row.

And write range in same file.

Loop this for each exel file in folder

this is Great @iakshman

how about i have plenty of Excel to delete of top 3 rows ,
and all of this excel is inside the Folder

1 Like

but he said without opening the .xlsx file

Insert/Delete Rows activity only valid Inside ExcelApplicationScope activity means the excel will be opened

Use workbook activity instead excelapplicationscope.

This my Problem
i have many excel file then all those file have a 3 rows must deleted .

@Aupe,

strFiles = Directory.GetFiles(folderPath)

Iterate that array using For each activity and inside take one excel application scope and pass item. Then it will take one by one file and will delete top 3 rows. For this use above workflow.

1 Like

Can’t use workbook activity for Insert/Delete Rows activity, because Insert/Delete Rows activity is valid only on ExcelApplicationScope activity.

You can try it.

1 Like

@Aupe you can use his idea. But it will still open your excel 1 by 1, but it will close your excel 1 by 1 automatically once each excel top 3 rows been deleted.

1 Like

but this will take a lot of time if there are files in bulk. How do we get this done without opening excel 1 by 1?

@VirajN
actually i can just make all cells on top 3 rows data to be null, but this will not delete the top 3 rows means your top 3 rows in your excel will be empty and the data starting from the row 4.

I know better to delete the rows instead of make the data to be empty without opening the excel.
But with the UiPath default activity seems no way to delete without opening excel, need to find 3rd party activity packages that can do that.

1 Like

just fyi … this is not a issue that i am facing but i am just keen to learn :smiley:

Hi @Aupe,

If you want to skip first 3 rows or N rows and take the rest all rows,

  1. Read Range - Datatable1
  2. Datatable1=Datatable1.Asenumerable.skip(3).copytodatatable
  3. Write Range Datatable1 on the same sheet, in the excel

but then the purpose is not met. i guess we will have to just open the excel 1 by 1 using for each activity and delete the 3 rows

1 Like

i agree with you.

with the UiPath default activity seems no way to delete without opening excel, need to find 3rd party activity packages that can do that.

1 Like

thank you :smiley:

1 Like

hi @ iakshman can you show me .xaml sample for me to check

thank you
aupe

the scenario are simple .

i have plenty of Excel file in my Folder.
hundreds or more.

and all those excel have 3 row must deleted
means i want to delete first 1 to 3 rows
and start with the row 4.

@Aupe,

Please find the attached workflow.

  1. Change the folder path.
  2. For Excel application scope, uncheck Visible and check auto save option in properties.
  3. If you don’t want to delete headers of that excel file then mention Position as 2 and also mention No. rows as 3.
  4. Is the sheet name will change for excel files ? If yes then declare one variable of type workbook application and say ‘workBook’. If you want to delete 3 rows from first sheet then pass sheet name as workBook.getSheets(0).

Test.xaml (10.4 KB)

2 Likes