Excel related problem

Hello
i have 2 sheet of data 1.xlsx and 2.xlsx
what is want to do is i need to check common data in both sheets
but i want data from sheet1 but Cr_date from sheet2 how can we achieve that
Adding 1,2 and desired output sheet OP
1.xlsx (8.4 KB)
2.xlsx (8.4 KB)
OP.xlsx (8.3 KB)

Hi @manoj_verma1

You can use an activity called Join Data Tables to achieve this result. As you need to get the common data from 2 data tables, you can use Inner Join operation.

https://docs.uipath.com/activities/other/latest/user-guide/join-data-tables

Hope this helps,
Best Regards.

@arjunshenoy this will add up the extra column i want any way we can directly make such changes under the date

@manoj_verma1

Even if you end up with an extra column, you can retain only the necessary columns by leveraging the DefaultView function.

yourDt = yourDt.DefaultView.ToTable(False,"Col1","Col2",.....)

Hope this helps,
Best Regards.

i already have have code in place that i dont want to disturb is there any way we do that directly

do you want to check only gross column ? for retrieving the rows from 1 xl

you can check below linq

If((From r1 In dt1.AsEnumerable
	From r2 In dt2.AsEnumerable
	Where r2("BOT").ToString.Trim = r1("Robot").ToString.Trim AndAlso r2("Process Name").ToString.Trim = r1("Process Name").ToString.trim
	Select r2
).CopyToDataTable.RowCount>0,(From r1 In dt1.AsEnumerable
	From r2 In dt2.AsEnumerable
	Where r2("BOT").ToString.trim = r1("Robot").ToString.trim AndAlso r2("Process Name").ToString.trim = r1("Process Name").ToString.Trim
	Select r2
).CopyToDataTable,dt1.Clone)

You can modify the this linq based on your requirement like changing the columnNames

as it is for two columns you can modify it based on your conditions

If you have any issue then please specify the condition

Regards

hi @LAKSHMI_NARAYANA_PEMMASAN i want all data as per excel1 but i want Cr_date as per in sheet 2 so i am looking for slution that common transaction to be picked as per sheet sheet one but i want dat pattern as per sheet2

check below

JoinTablesIntoNewTable.xaml (9.3 KB)

If((From r1 In dt1.AsEnumerable
	From r2 In dt2.AsEnumerable
	Where r2("Gross").ToString.Trim = r1("Gross").ToString.Trim
	Select op.Rows.Add({r1("Gross").ToString,r1("level").ToString,r2("CR_Date").ToString})	
).CopyToDataTable.RowCount>0,(From r1 In dt1.AsEnumerable
	From r2 In dt2.AsEnumerable
	Where r2("Gross").ToString.Trim = r1("Gross").ToString.Trim
	Select op.Rows.Add({r1("Gross").ToString,r1("level").ToString,r2("CR_Date").ToString})
).CopyToDataTable,dt1.Clone)

Hope this helps
Regards

1 Like

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