+ Reply to Thread
Results 1 to 4 of 4

comparing csv files using macro

  1. #1
    Registered User
    Join Date
    09-05-2007
    Posts
    2

    comparing csv files using macro

    Please help me out to find out the way for comparing two csv files row by row.It has to return the output as row added/row deleted/changed row...using macro as other comparitive softyware does..
    Thanks
    Uma

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967
    Yes - this is possible in principle.

    However, I would suspect that you have to decide which actions you wanted to detect.

    For instance, an edited row could also be seen as a row that had been deleted and something else added.

    Use of the Line Input statement within a loop with both files opened using the Open {filename} for input as #1/2 should work.
    Martin

  3. #3
    Registered User
    Join Date
    09-05-2007
    Posts
    2
    Hi,
    I wanted to find out in three ways...(with reference to the first file)
    1)Entire row has been deleted in the second file
    2)Entire row has been Added in the second file
    3)one or more than one- cell value in a row is changed.

    Please give me the logic and associated function/commands in macro to develope the code...

  4. #4
    Registered User
    Join Date
    09-06-2007
    Posts
    6

    Comparing CSV Files

    Let's say you compare line by line in a loop using 1st file as a reference.
    If lines match, no action.
    If lines don't match - 3 possibilities
    #1 -1 or more lines were deleted from file 2
    #2 -1 or more lines were added to file 2
    #3 - the line was edited

    It seems that a criteria is needed to distinguish between an edited line
    vs a combination of add, delete.
    Ie - a restriction on how many items can be changed that allows the line to be considered edited and not new.
    If you can define this restriction, the edited lines can be identified. Then it is easy to identify added/deleted lines. If you need more help please send private message,- Steve

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1