<img src="//trc.taboola.com/1222697/log/3/unip?en=page_view" width="0" height="0" style="display:none">


The Knowledgebase articles are deprecated. Please visit the new Guides and Resources here: https://www.uipath.com/developers/guides-and-resources.

Knowledge Base

Remove Excel Rows That Contain Keywords

  • To be able to run this example you need to install UiPath.Excel.Activities. See more details on how to install packages here.
  • Download Demo Project


Go through a spreadsheet and remove rows that contain keywords from a predefined list.

Scenario: We have an Excel sheet with cars and according to SellerType we will build a list of words ... something like {"Private Seller", "Other"}. All the vehicles that has one of the words from the list will be deleted.

Steps to automate

  1. Read the Excel sheet and put all the data into a DataTable.
  2. Create the list of words.
  3. Create a loop that goes through the list, for each word, check the data table and delete the row that contains the word.
  4. Write the result into a new Excel sheet.


  1. Read the Excel sheet using "Read Range" activity. This activity take all the rows from an Excel sheet and creates a data table in memory.
  2. The list is an array of strings. You could define this variable in the down side panel of UiPath Studio.
  3. Use a "For Each" activity to go through the list of words. Search for each word into the data table and remove the row that contains it. The data table has a very powerful method which is called Select. This method request a query and returns an array of all DataRow objects that match the filter criteria. 
  4. In a "While" loop we have to delete all the data rows from the array.
  5. Finally after all the rows were processed we could write into an Excel sheet the result using "Write Range" activity.