# Comparing Excel sheet with CSV

**URL:** <https://forums.powershell.org/t/comparing-excel-sheet-with-csv/8400>\
**Category:** PowerShell Help\
**Created:** [April 9, 2017, 9:58am UTC](https://forums.powershell.org/t/comparing-excel-sheet-with-csv/8400 "2017-04-09T09:58:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![firefoxmig](https://avatars.discourse-cdn.com/v4/letter/f/e480ec/32.png) [@firefoxmig](https://forums.powershell.org/u/firefoxmig)\
**Post date:** [April 9, 2017, 9:58am UTC](https://forums.powershell.org/t/comparing-excel-sheet-with-csv/8400/1 "2017-04-09T09:58:56Z")

</div>

Hello all,

I´ve a script to compare a CSV (into array)file with Excel as Database. CSV file are numbers to inactivate and the idea is if the number doesn´t match, it´ll export to a file. When CSV value is the same works perfectly, but If doesn´t match, it exports all numbers from excel. How Could export only mismatched value?

> <https://gist.github.com/anonymous/bee721a1e593183bcb57b909c4bac7a0>

Regards

---

<div class="post-metadata">

**Author:** ![sam-boutros](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/sam-boutros/32/5_2.png) [@sam-boutros](https://forums.powershell.org/u/sam-boutros)\
**Post date:** [April 9, 2017, 7:48pm UTC](https://forums.powershell.org/t/comparing-excel-sheet-with-csv/8400/2 "2017-04-09T19:48:32Z")

</div>

In the beginning of line 17, replace $Csv with $item

---

<div class="post-metadata">

**Author:** ![firefoxmig](https://avatars.discourse-cdn.com/v4/letter/f/e480ec/32.png) [@firefoxmig](https://forums.powershell.org/u/firefoxmig)\
**Post date:** [April 10, 2017, 3:21pm UTC](https://forums.powershell.org/t/comparing-excel-sheet-with-csv/8400/3 "2017-04-10T15:21:57Z")

</div>

Hello Sam,

I did it and it generated a file with all numbers.An example:

CSV. Last number is different than Excel  
710377057  
13697645  
749166209  
736940169  
837598441  
943435113  
123456789  
567890113  
Excel  
710377057  
13697645  
749166209  
736940169  
837598441  
943435113  
123456789  
763893584

And it generate this eight times:  
710377057  
13697645  
749166209  
736940169  
837598441  
943435113  
123456789  
567890113  
It exports all values but not the mismatched value.I don´t know why happen this.

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:39pm UTC](https://forums.powershell.org/t/comparing-excel-sheet-with-csv/8400/4 "2024-05-16T20:39:27Z")

</div>


