

There are a couple of methods available to compare the different sheets of your Excel file. This session type only supports comparing a single sheet in Beyond Compare. XLSX file"īy default the Table Compare session type is used for Excel. I want to compare all of the sheets in my Excel.

"I was comparing my Excel files in BC but it is only showing one sheet.

Tool to compare two columns in excel code#
I have modified my code according to your advice, you could try the following code.Comparing multiple sheet Excel files BC version 3 or 4 Let me know if you still dont get the input. with 4 not same so it will reflect on the result sheet.(firstHeading = B and SecondHeading=bb and ValuesinSheet1 = 2 and valueinSheet2 = 4). now it will check for the difference in the vlaues(B'Coumns value).Ģ. In Case of B, Headings in Sheet 2 are B and bb and headings in sheet2 are B and bb. as A and A are same but aa and bb are not same so it will not check for further values(A'Columns Value). I have 2 headings on the basis of that comparison starts.Īs in case of A, Headings in Sheet1 are A and aa and Heading in sheet2 are A and bb.
Tool to compare two columns in excel free#
MSDN Support, feel free to contact Jack,įirstHeading SecondHeading ValueinSheet1 ValueinSheet2 so no need to check for valueĪccording to your advice, I have modified my code. Here Heading Y is on both the sheets but 2nd heading value is different(ff and bb) so it will not go futher to check the value.Īnd Same for P(it have hh value in sheet1 and ll in sheet 2). In this i have to give different data as well as data which is not in sheet1. then how can i add, i mean it should read data of sheet automatically. May be on new excel sheet there is X and xx. You are adding A to sheet 1 then sheet 2. and maybe on this case there is 5 columns. It should read data of sheet automatically not manually. You are putting manually data on the sheet. I am really thankful to you that you helped. Public static DataTable datatable(string path,string sheetName) static void Main(string args)ĭataTable sheet1 = datatable("D:\\test.xlsx", "Sheet1") ĭataTable sheet2 = datatable("D:\\test.xlsx", "Sheet2") MSDN Support, feel free to contact adwikcool,īased on your description, you want to compare 2 excel sheet and save the results(differences) to the another file. If you have any compliments or complaints to This can be beneficial to other community members reading this thread. Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. Using (OleDbDataAdapter da = new OleDbDataAdapter())

Using (OleDbCommand comm = new OleDbCommand())Ĭomm.CommandText = "Select * from " Using (OleDbConnection conn = new OleDbConnection(connectionString)) String connectionString = Source=" + path + " " + "Extended Properties='Excel 12.0 Xml HDR=YES IMEX=1 MAXSCANROWS=0'" Public static DataTable datatable(string path, string sheetName) Select(row => string.Join(",", row.ItemArray)) įile.WriteAllLines("D:\\excel.csv", lines) Var header = string.Join(",", columnNames) List lst2 = (from d in sheet2.AsEnumerable() select d.Field(a)).ToList() List lst1 = (from d in sheet1.AsEnumerable() select d.Field(a)).ToList() ("ValueinSheet2", typeof(int)) įoreach (DataColumn column in sheet1.Columns)įoreach (DataColumn column1 in sheet2.Columns) class ProgramĭataTable sheet1 = datatable("D:\\Test1\\test.xlsx", "Sheet1") ĭataTable sheet2 = datatable("D:\\Test1\\test.xlsx", "Sheet2") I have modified my code according to your advice, you could try the following code.
