powershell script to copy duplicate rows in one excel file to another excel file

%3CLINGO-SUB%20id%3D%22lingo-sub-390660%22%20slang%3D%22en-US%22%3Epowershell%20script%20to%20copy%20duplicate%20rows%20in%20one%20excel%20file%20to%20another%20excel%20file%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-390660%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%3EHow%20find%20duplicate%20Values%20In%20Excel%20and%20Export%20Rows%20to%20another%20sheet%20using%20PowerShell.%20I%20had%20an%20excel%20sheet%20with%20multiple%20rows%20and%20column%20lets%20say%20from%20A%20to%20K.%20I%20need%20to%20find%20duplicate%20rows%20only%20if%20values%20in%20all%20the%20columns%20in%20a%20row%20are%20unique.%20And%20the%20script%20should%20ignore%20D%2CE%2CF%20columns%20even%20though%20those%20column's%20values%20are%20same.%20The%20script%20should%20also%20copy%20all%20those%20duplicate%20rows%20and%20should%20paste%20in%20a%20new%20excel%20file.%20Also%20attaching%20a%20sample%20image%20of%20input%20file%3C%2FSPAN%3E%3CSPAN%3E.%20Can%20any%20one%20help%20me%20on%20this.%20Thanks%20in%20advance.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENote%3A%26nbsp%3B%3CSPAN%3EI%20don't%20need%20unique%20rows%20I%20need%20only%20duplicate%20rows%20as%20an%20output%20and%20the%20output%20should%20also%20contain%20source%20duplicated%20row.%3CSPAN%20class%3D%22comment-copy%22%3Ei%20need%20output%20as%202%20to%207%20in%20this%20scenario(picture%20attached).%20the%20original%20file%20has%201lac%26nbsp%3Brows%20like%20this.%20This%20attached%20one%20is%20just%20reference%20file%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-390660%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel-powershell%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPowerShell%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Epowershell%20script%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EWindows%20PowerShell%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-390687%22%20slang%3D%22en-US%22%3ERe%3A%20powershell%20script%20to%20copy%20duplicate%20rows%20in%20one%20excel%20file%20to%20another%20excel%20file%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-390687%22%20slang%3D%22en-US%22%3E%3CP%3EWow%20vba%20and%20powershell%20both%20will%20lend%20themselves%20to%20scripting.dictionary%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F310389%22%20target%3D%22_blank%22%3E%40RameshS%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
New Contributor

How find duplicate Values In Excel and Export Rows to another sheet using PowerShell. I had an excel sheet with multiple rows and column lets say from A to K. I need to find duplicate rows only if values in all the columns in a row are unique. And the script should ignore D,E,F columns even though those column's values are same. The script should also copy all those duplicate rows and should paste in a new excel file. Also attaching a sample image of input file. Can any one help me on this. Thanks in advance.

 

Note: I don't need unique rows I need only duplicate rows as an output and the output should also contain source duplicated row.i need output as 2 to 7 in this scenario(picture attached). the original file has 1lac rows like this. This attached one is just reference file

1 Reply
Highlighted

Wow vba and powershell both will lend themselves to scripting.dictionary

@RameshS