Forum Discussion

synchi64's avatar
synchi64
Occasional Contributor
4 years ago
Solved

Testing Excel Files

Greetings,   I need help to figure out a way to test excel files, essentially comparing excel files in two different folders, I have a functioning code, however it takes way too long and I need to...
  • BenoitB's avatar
    BenoitB
    4 years ago

    ExcelCompare works well.and it's the fastest.

     

    How to make it works ?

     

    For excelCompare you must download the script extension package here (down of the page):

    https://support.smartbear.com/viewarticle/42199

     

    You copy file here (assuming you have standard installation):

    C:\Program Files (x86)\SmartBear\TestComplete 14\Bin\Extensions\ScriptExtensions

     

    In TestComplete go to File -> Install Script Extension -> click on Reload of the dialog and normally you should have the Excel compare available (if not checked, check it).

     

    For comparing specific sheet you have an article here:

    https://support.smartbear.com/viewarticle/9046/

     

    This code

    function TestCompare() {
      let file1 = "c:\\temp\\lsaexpert.xlsx";
      let file2 = "c:\\temp\\lsaexpertt2.xlsx";
      let resultFile = "c:\\temp\\result.xlsx";
      Log.Message(objectExcel.ExcelCompare(file1, file2, resultFile));
    }
    

    Give a resultFile.xlsx containing that:

    This is a result file which highlights the differences between the files ...											
    File 1 : c:\temp\lsaexpert.xlsx											
    File 2 : c:\temp\lsaexpertt2.xlsx											
    =================================================================================================================											
    Sheet Name	Cell	Data in File 1	Data in File 2								
    lsaexpert	B3	PULSAT	AAA								
    lsaexpert	B7	PRO & CIE	AAAAAAAAA								
    lsaexpert	D2	"74 rue Jean Jaures
    59410 Anzin
    SOCIÉTÉ EXPLOITANTE
    REMY DISTRIBUTION ELECTROMENAGER
    N° SIRET : 438 567 901 00030
    Tél : 03.27.46.12.12
    Site internet : www.anzin.extra.fr
    "	aaaa								
    lsaexpert	D7	"3 rue du Général de Gaulle
    59225 Clary
    SOCIÉTÉ EXPLOITANTE
    SARL TAISNE PERE ET FILS
    N° SIRET : 539 772 483 00019
    Tél : 03.27.85.53.85
    Fax : 03.27.85.17.53
    Site internet : procie-clary.com
    "	zzzzzz								
    lsaexpert	E2	"Gérant : M. Gérald THURU
    "	aaa