Best approach to compare 2 CSV files

Hi , what would be the best approach to compare 2 CSV files having large set of data in terms of lakhs of rows and number of columns.
Using data table and joins , it is taking considerable amount of time.
Can someone please guide with steps which helps faster result execution

Hi @rinki,

Just a suggestion, I have two excels with lakhs of records, and I compare them using Vlookups. But if we use the existing activities, it will take huge time to complete. Better to go with Invoke Code activity and write piece of code to compare . I find it is far better in terms of time

Hi @HareeshMR ,

Yes right the built in activity are taking time for comparison.
Can you share your sample vlookup code for reference, i want to check if it’s feasible for my requirements since I have 30+ columns and I want to compare each row for every column of data.

Here is the code

With ws
For i = 2 To RevenueRange
ws.Range(“A” + i.ToString).Formula = “=VLOOKUP(Revenue!A” + i.ToString + “,Cost!$A$2:$B$” + CostRange.ToString + “,1,FALSE)”
Next
End With

Here ws is the worksheet, RevenueRange is the range of sheet1 and CostRange is the range of sheet2. Comparing Revenue sheet A and Cost Sheet A here. You can write the code in the same way to compare remaining all columns.

And how to call this code in uipath ?

use invoke code activity or invoke method wiyhin excel application scope.

If you use invoke code, you need to write code to open the excel file.

Here is the code to open the excel file :

Dim excel As Microsoft.Office.Interop.Excel.Application
Dim wb As Microsoft.Office.Interop.Excel.Workbook
Dim ws As Microsoft.Office.Interop.Excel.Worksheet
wb = excel.Workbooks.Open(" PATH OF EXCEL FILE ") ‘Open the excel the file’
excel.Visible = True

        ws = CType(wb.Sheets("Sheet1"), Microsoft.Office.Interop.Excel.Worksheet) 'select a sheet and activiates'
        ws.Activate()