Forum Discussion

ChrisPro's avatar
ChrisPro
Contributor
10 years ago

Check all csv/excel columns, except for a set of columns

An application generates a CSV file or Excel file, and I would check all the columns except for a set of columns with a CSV file reference.



For-example, the application generates export.csv, and i would compare all columns with reference.csv, except for columns 2, 7, and 9.



What is the procedure in Jscript?



Thank you for your reply.

5 Replies

  • i'm not exactly too familiar with Jscript, but I would Record a keyword test (you can always convert the keyword test to script  to get flexibility of using a script if you want) opening the CSV / XLS /XLSX files in ms excel then have the recorded screenshot masking the column that you do not want to compare then have it compare against the recorded view for when you open the generated file.



    Sorry if this is not what you wanted.
  • Joseph,

    Is the links to download the script extentions on both help articles dependant on having TestComplete installed in order to download them?



    If the downloads are not dependant then the link is not working.



    I am getting a GenericError.htm?aspxerrorpath=/support/media/images/support/kb/data/2010/6/1/ExcelSheetCompare.tcx.aspx



    I tried to download the script extentions in firefox.

  • No, you don't need TestComplete installed in order to *download* the TCX files.  (but installing TestComplete will have created the file association for the TCX extension to help you install the extension...)



    I notice that there is an ASPX extension in your error message.  I don't know where that is coming from but the correct links are



    http://support.smartbear.com/support/media/images/support/kb/data/2010/6/1/ExcelSheetCompare.tcx



    http://support.smartbear.com/support/media/images/support/kb/data/2012/12/24/ExcelCompare.tcx



  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)
    An application generates a CSV file or Excel file, and I would check all the columns except for a set of columns with a CSV file reference.

    For-example, the application generates export.csv, and i would compare all columns with reference.csv, except for columns 2, 7, and 9.


    Database checkpoints can check just a subset of columns. You just need a connection string to connect to your CSV or Excel file as a database. For example, CSV connection strings look like this:

    Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\CSVFileFolder\;Extended Properties="text;HDR=Yes;FMT=Delimited";


    C:\CSVFileFolder\ is the folder that contains the CSV file.

    HDR=Yes means that the first row in the CSV file contains column names. If not, use HDR=No.

    FMT=Delimited means the separator is a comma.



    The only thing is that database checkpoints don't compare two files, they check the same file you created the checkpoint for. For example, if you created a checkpoint for the baseline file C:\reference.csv, then your application must export data to C:\reference.csv during the test run.