Contributions
Re: How to compare two Excel workbook's cell values
Hi Sonya, Thank you for your message. We decided the leave comparing excel files for now as we did further analysis and came to the conclusion it would be far too complicated as the formatting is is completely different in the files we wanted to compare. Thanks, Ivett1.5KViews1like0CommentsRe: How to compare two Excel workbook's cell values
Hi Robert, Thank you for your quick reply. I changed the code to this: function CompareExcel() { let Excel = getActiveXObject("Excel.Application"); let xlfile1 = "S:\\Software\\mytilney.xlsx"; let xlfile2 = "S:\\Software\\plan.xlsx"; let RowCount = Excel.ActiveSheet.UsedRange.Rows.Count; let xlWorkbook1 = Excel.Workbooks.Open(xlfile1); let xlWorkbook2 = Excel.Workbooks.Open(xlfile2); for (let i = 1; i <= RowCount; i++) { if (xlWorkbook1.Cells(i,1).Value === xlWorkbook2.Cells(i,1).Value) { Log.Message("The files are the same."); } }; Excel.Quit(); } But when I run it I'm still getting the same error: 'TypeError: xlWorkbook1.Cells is not a function' Thanks, Ivett1.7KViews0likes3CommentsHow to compare two Excel workbook's cell values
Hi, We are trying to compare two Excel workbooks by specifying which cells should be compared as the column orders don't match in the files. We aren't a very technical team and tried to run the code below, but we get the following error (see screencapture attached too): 'TypeError: xfile1.Cells is not a function' function CompareExcel() { let Excel = getActiveXObject("Excel.Application"); let xlfile1 = "S:\\Software\\mytilney.xlsx"; let xlfile2 = "S:\\Software\\plan.xlsx"; Excel.Workbooks.Open(xlfile1); Excel.Workbooks.Open(xlfile2); //let xsheet1 = xlfile1.Sheets("Sheet1"); //let xsheet2 = xlfile2.Sheets("Sheet1"); let RowCount = Excel.ActiveSheet.UsedRange.Rows.Count; let ColumnCount = Excel.ActiveSheet.UsedRange.Columns.Count; let Cells = Excel.ActiveSheet.UsedRange.Cells.Select; for (let i = 1; i <= RowCount; i++) { if (xlfile1.Cells(i,1).Value === xlfile2.Cells(i,1).Value) { Log.Message("The files are the same."); }}; Excel.Quit(); } Is there anyone who could help is fix this this error please? Any help would be much appreciated. We used the following documentation to produce this code: https://support.smartbear.com/testcomplete/docs/testing-with/advanced/working-with-external-data-sources/excel/working-via-com.html https://community.smartbear.com/t5/TestComplete-Desktop-Testing/Comparing-2-xls-files-with-the-specific-column/td-p/133603 Thanks, Ivett1.7KViews0likes5CommentsComparing Excel files - Can't find file
Hi Everyone, I've been trying to run the script for comparing the Excel files, but I get the following error when I try to run it: 'Sorry, we couldn't find\tilney.dev\\dfs\\user_data\\Kaufman_Dev\\Desktop\\mytilney_t.xlsx. Is it possible it was moved,renamed or deleted? Microsoft Excel script.vbs Line: 11 Column: 2. Plug-in: Excelfiles checkpoint 1.3 by Smartbear Corp. Location: c:\Program Files (x86)\SmartBear\TestComplete 14\Bin\Extensions\ScriptExtensions' Please also see screencapture attached. The script is as follows: function Main() { xlfile1 = "\\tilney.dev\\dfs\\user_data\\Kaufman_Dev\\Desktop\\mytilney_t.xlsx"; xlfile2 = "\\tilney.dev\\dfs\\user_data\\Kaufman_Dev\\Desktop\\plan_t.xlsx"; resfile = "\\tilney.dev\\dfs\\user_data\\Kaufman_Dev\\Desktop\\result.xlsx"; Log.Message(objectExcel.ExcelCompare(xlfile1,xlfile2,resfile)); } The file paths and names are correct I believe - any ideas why the file cannot be found? Many thanks, IvettSolved1.7KViews0likes3Comments