How to Combining Two Data Tables in UiPath
Introduction:
in data automation workflows, it’s common to encounter scenarios where data is spread across multiple sources. Combining data from different files or tables into a single consolidated dataset can simplify data analysis and streamline further processing
In this article, we will guide you through the process of combining two data tables into one using UiPath, with an option to filter the data before writing it to an Excel file.
Step 1: Read Data from Excel Files
The first step is to read data from the Excel files into data tables. In this example, we have two Excel files, Input_data1.xlsx and Input_data2.xlsx, each containing data that we want to combine.
- Read Range Workbook Activity for type1.xlsx:
- File Path: Input_data1.xlsx
- Sheet Name: “Sheet1”
- Output Data Table: Data1
- Read Range Workbook Activity for type2.xlsx:
- File Path: Input_data2.xlsx
- Sheet Name: “Sheet1”
- Output Data Table: Data2
Step 2: Merge Data Tables
After reading the data, you can combine the two data tables using the Merge Data Table activity.
- Source: Data1 (the data table you want to merge into the destination)
- Destination: Data2 (the data table that will hold the combined data)
The Data1 data table now contains the merged data from both Input_data1.xlsx and Input_data2.xlsx
Step 3: Filter the Merged Data Table (Optional)
If you need to filter the combined data table to meet specific conditions, you can use the Filter Data Table activity.
- Input Data Table: Data1 (the merged data table)
- Output Data Table: Data1 (or you can create a new data table for the filtered results)
In this step, you can configure the filter conditions according to your needs. This step is optional and can be skipped if filtering is not required.
Step 4: Write the Combined Data to an Excel File
Finally, you can write the combined (and optionally filtered) data table to a new Excel file.
- Write Range Workbook Activity:
- File Path: Output.xlsx
- Sheet Name: “Sheet1”
- Input Data Table: Data1
This step writes the contents of dtType1 to the specified Excel file, creating a consolidated data set.
Conclusion:
Merging data tables in UiPath is a simple yet powerful capability that can significantly enhance your automation workflows. By following the steps outlined in this article, you can seamlessly combine data from multiple sources, apply necessary filters, and store the results in a single Excel file.