Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi -- I have 2 excel files (exl1.xls and exl2.xls) in which I need to compare column A with exl2.xls(multi tab sheet). Column F is having server names, may be separated with comma or in next line in one field. I need to compare all these values with second excel. If any of the value matches then I want to print complete row of that column with A-E. Let me know, if anybody can help Rishabh

Replies are listed 'Best First'.
Re: comparing 2 excel files
by marinersk (Priest) on Mar 12, 2015 at 13:58 UTC

    I'd consider either exporting the spreadsheets to CSV or TSV format and then the Text::CSV_XS module to access the data, or use the Spreadsheet module to get at the data directly.

    For the comma-separated list, you would of course probably be reasonably well-served by the split command, or feed that into a secondary Text::CSV_XS object.

    Once everything is in a list, there are a variety of ways to compare the list, but the easiest for a new programmer to understand will probably be looping through an array.

    A hash would likely be more execution-efficient, but you would need to understand how to use hashes and you give no indication of having that level of experience.

        Thank you.

        :: placing that in pocket for future use ::