Forum Discussion
shankar_r
8 years agoCommunity Hero
I'm not sure you can compare two excel files or excel sheets using Dictionary object.
And also there is no way to get ExcelObj as undefined from your code since there is no ExcelObj is mentioned in your code.
Can you post log which you got for this.
nsag_1512
8 years agoOccasional Contributor
function Main()
{
var oExcel = Sys.OleObject("Excel.Application");
var aSheets = Sys.OleObject("Scripting.Dictionary");
//You can specify the sheet to be compared
//var vSheet = "Sheet1";
//aSheets.Add(vSheet, vSheet);
var fileName = "C:\\Users\\ghaniabd\\Desktop\\excel";
var aInfo1 = ExcelObj.CreateInfo(oExcel, "1.xlsx", "Aging Summary (01 1 2017 - 03 1");
var fileName = "C:\\Users\\ghaniabd\\Desktop\\excel";
var aInfo2 = ExcelObj.CreateInfo(oExcel, "2.xlsx", "Aging Summary (01 1 2017 - 03 1");
var oResult = ExcelObj.Compare(aInfo1, aInfo2);
if (oResult.length > 0)
{
Log.Warning(oResult);
}
else
{
Log.Message("The files are the same.");
}
oExcel.Quit();
}Sorry this is latest the code with the ExcelObj..