Loop: Delete Row if the value in Column H is Blank?


I have a BOT that loops to query a web page using zipcode and downloads the results in separate .xlsx files. I then merge all the files into one “merge.xlsx” file.

I want to then iterate through the merge.xlsx file and delete all rows where the value in Column H is null/blank.

With what I’ve found searching through the forum, I feel like I’m trying to pound a nail in with a sledgehammer. I imagine there’s a fairly simple solution to this, but I’m not seeing it. Any suggestions or .xaml file examples would be most helpful.



You don’t delete the rows from Excel. You load the Excel sheet into a datatable, delete the rows you don’t want, then write it back to Excel with Write Range.

Use read range Workbook or Excel activity load your excel sheet as datatable, after that you can filter out the data which has values in H column using Filter Datatable activity or LINQ query.

  1. In filter Datatable set the conditions as per your need and it will do the job for you, write back the datatable to excel using wirte range activity.

  2. Using LINQ - var FilteredDT = (from row in loadedDatatable.AsEnumerable() where row.item(“H Column Name”) isNot Nothing select row).CopyToDatatable()
    then do the same save FilteredDT in excel using write range.

hope this helps.

1 Like

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