Announcement

Collapse
No announcement yet.

Excel compare script that ignores column(s)

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Excel compare script that ignores column(s)

    I regularly use calls to Beyond Compare from DOS batch files to find differences between Excel spreadsheets using calls such as ...

    bcomp.exe "@c:\some path\myScript.txt"

    Now I need to know if there is a way to continue executing compares from the batch file but now be able to ignore a pair of columns in each Excel file. The columns to ignore contain time and date information that is not of interest. I see references in the forums to creating folder sessions for other needs and saving them for later use. Is there a way to write a script that tells bcomp.exe to ignore the columns that are not needed? Perhaps with one of these folder sessions?

    Thanks,

    Randy

  • #2
    Hello,

    The way to tackle this is to pre-save a Folder Compare or to update the Session defaults so that loading these files has the Unimportance already set. The graphical interface or script can then load the files and perform the comparison, since script itself cannot set the Unimportance of columns.

    To set in the interface, you can either:
    use the Home screen, expand the New folder in the saved Sessions list, and edit the global defaults of any new Table Compare session.

    or

    Load a new folder compare that contains your file pairs, double click and view your files, and set the columns as Unimportant (right click the column headers, and view that the files compare as you need). Then close the child Table Compare, and save the Folder Compare session. This Folder Compare can be loaded in script and a report generated (either folder level or file content level). Note: saving and loading a Table Compare session is not supported in scripting.
    Aaron P Scooter Software

    Comment


    • #3
      Originally posted by Aaron View Post
      Load a new folder compare that contains your file pairs, double click and view your files, and set the columns as Unimportant (right click the column headers, and view that the files compare as you need). Then close the child Table Compare, and save the Folder Compare session. This Folder Compare can be loaded in script and a report generated (either folder level or file content level). Note: saving and loading a Table Compare session is not supported in scripting.
      Thanks very much for the instruction Aaron.

      I am trying to implement the second recommendation you provided for tackling my request but want to clarify the reference to the child Table Compare. My interpretation is that the child Table Compare opens as the result of double-clicking on a file name from within the Folder Compare view. This results in a file compare of the targeted files. I then right-click on the column headers I want to ignore and mark them as unimportant. This changes them from red to blue telling me they indeed have been marked as unimportant.

      Here is where I then attempt to save these changes to the session so I can load it from my script. However when I close the child Table Compare by clicking Session>Save it prompts me for a new session name and then saves it as a file compare instead of a folder compare which doesn't do my script any good later.

      If I simply close the child Table Compare, my changes to the column importance are lost and the next time I run the compare, there are all sorts of differences detected as you would expect.

      Is my interpretation of the meaning of the child Table Compare correct?

      I think I am close but just need to figure out how to save the "unimportant" designation within the scope of a folder compare (instead of file compare).

      Below is the script I am using with the session I have saved.

      load "MySession"
      filter "myFile.csv;"
      criteria rules-based
      load "C:\MyBaselineFolderPath" "C:\MyProductionFolderPath"
      expand all
      select all.diff
      data-report layout:side-by-side options:display-mismatches,ignore-unimportant &
      output-to:"C:\MyReportPath\ReportName.html" output-options:html-color

      Comment


      • #4
        Hello,

        The key is to launch the child Table Compare's Session menu -> Session Settings, and update the dropdown from Use for this view only -> Use for these files in parent session or Use for all files in parent session (also, double check the Columns tab to verify Unimportance).
        Then close the child session, and save the parent Folder Compare.

        How does this work for you?
        Aaron P Scooter Software

        Comment


        • #5
          Originally posted by Aaron View Post
          How does this work for you?
          Perfect! Thanks Aaron!

          That's all that was needed. Everything is working great now.

          Randy

          Comment

          Working...
          X