<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

Compare DataTables


To be able to run this example you need to install UiPath.Excel.Activities. See more details on how to install packages:


This sample extract from an Excel file two DataTables and compare each cell from the first DataTable with the corresponding cell of the second DataTable.

Steps to automate

  1. Read Sheet1.
  2. Read Sheet2.
  3. Get the number of columns and rows for each sheet.
  4. Check if both DataTables have the same size.
  5. If their sizes are the same then compare the elements.
  6. In case of identical DataTables display a message like "DataTables have the same information".
  7. Otherwise display a message like "DataTables are different!".


  1. Read both sheets and convert them into DataTables using "Read Cells Range" activity.
  2. Get the number of columns and rows using the name of the table and ".Rows/Columns.Count".
  3. Use a "FlowDecision" activity to check if both DataTable have the same size.
  4. If their sizes are the same then compare the elements using a "While" activity, a columnIndex and a rowIndex.
  5. Display a message using "Message box" activity to inform the user regarding the result.