Skip to main content
Question

Deleting the rows from excel

  • December 4, 2025
  • 3 replies
  • 16 views

Forum|alt.badge.img+2

Hi,

 

Is there any easy way to delete the excel rows based on certain condition.

currently i m following the method of filtering the excel rows by lopping and check the if condition is yes then adding to list and again looping the list to delete row by row. though this case works correctly i still don't find it effective as it takes a lot of time. since our excel very huge it take 5 to 10min to delete this data

3 replies

Anjali.K1
Navigator | Tier 3
Forum|alt.badge.img+5
  • Navigator | Tier 3
  • December 4, 2025

@Abisha Gopalan Try Excel Advanced > Filter Table to filter rows matching your condition, then Excel Advanced > Delete Range on the filtered visible rows.

 


Padmakumar
Premier Pathfinder | Tier 7
Forum|alt.badge.img+15
  • Premier Pathfinder | Tier 7
  • December 4, 2025

Hi ​@Abisha Gopalan,

 

There are plenty of different approaches to achieve this.

  1. You can use line script like VBA or Python (Faster and reliable)
  2. Delete in ranges, not row‑by‑row

              i) Option A—Use the Excel Advanced →  Delete row or column action with a range

Instead of looping, compute a contiguous range (e.g., 2:5000) or multiple ranges and call Delete Row by range (e.g., 1:5, 10:15) to remove them at once. The action supports bulk deletion by specifying ranges. 

             ii) Option B—Filter first, then delete visible rows (VBA from AA or AA steps)

Drive Excel via AA:

Open workbook (Excel Advanced): Apply a Filter (Excel Advanced →  Apply filter or use Keystrokes if  needed). Call a small VBA macro (above) via Run Macro (or inject with AA’s “Run script” approach) to delete visible rows at once. This is often faster than AA deleting row‑by‑row because Excel does the heavy lifting internally.

 

  1. Treat Excel as a database; bulk keep or bulk delete with SQL

    Connect to the workbook with OLE DB/ADO and use SQL to select only the rows you want (write out filtered rows to a new sheet), then replace the original. It avoids per‑row deletes and scales better on huge files

  2. Use Data Table in AA

    Import the sheet into a Data Table, use filter/loop just to build a new Data Table containing only the rows you want to keep, and then write it back (overwrite the sheet). This replaces deletion with a single write operation. Community experts recommend this for large datasets where direct deletes are slow.

  3. If you’re removing blank rows only

    AA published a step‑by‑step using Excel Advanced → Remove blank rows, which deletes blank rows across a range without manual loops. Useful if your condition is a blank row


Aaron.Gleason
Automation Anywhere Team
Forum|alt.badge.img+14
  • Automation Anywhere Team
  • December 4, 2025

@Abisha Gopalan If you have this much data in Excel, you're probably using the wrong tool. Excel is not a database. 

That being said, using the Excel Basic package works significantly faster than the Excel Advanced package because it works directly with the file, not through a conduit to Excel itself. Consider that first. 

The other possibility is to read the contents of the Excel file into a data table variable and do your manipulation there. That is dangerous though because the row indices must be carefully manipulated due to rows being deleted. 

Both of those will significantly speed up Excel operations -- but not as much as using the right tool for the job: an actual database.