# Suggestions for parsing/editing CSV files on a per-value basis?

**URL:** <https://forums.powershell.org/t/suggestions-for-parsing-editing-csv-files-on-a-per-value-basis/13053>\
**Category:** PowerShell Help\
**Created:** [August 26, 2019, 7:33am UTC](https://forums.powershell.org/t/suggestions-for-parsing-editing-csv-files-on-a-per-value-basis/13053 "2019-08-26T07:33:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jadedarchitect](https://avatars.discourse-cdn.com/v4/letter/j/cdc98d/32.png) [@jadedarchitect](https://forums.powershell.org/u/jadedarchitect)\
**Post date:** [August 26, 2019, 7:33am UTC](https://forums.powershell.org/t/suggestions-for-parsing-editing-csv-files-on-a-per-value-basis/13053/1 "2019-08-26T07:33:54Z")

</div>

Okay, I have a difficult task here, and I have a general idea of what I’ll need to do.

I’m matching 2 values from one CSV against other CSV’s, and pulling a specific number from the other CSV’s into the main CSV, then adding that data to the line where the values were matched.

I have a CSV (CSV A) that I need to check for 2 specific values. Value 1, Value 2.

If Value 1 , with a Value 2 match, then $V12 needs to be appended.

If Value 1, with a Value 3 match, then - $V13 needs to be appended.

&nbsp;

The $v12 and $v13 values will be coming from separate CSV’s, all stored in the same folder.

Value 1 exists in ALL CSV’s and is an identifier. Value 2 will be a variable between 1 and 10. Dependent on the value of Value 2, I will pull another number from CSV 2, let’s call it Value 4. Value 1 and Value 2 must match to pull the correct Value 4 in CSV B, the same goes for Value 1 and Value 3.

EX: CSV1

> Value 1 row | Value 2/3 Row
> 
> 1 2

  
1 3

&nbsp;

CSV2

Value 1 row | Value 2/3 row | Value 4 Row

1 2 .40

1 3 .50

So, I’ve gotten the gist of setting the data I’m searching for the first CSV.

> import-csv $CSV1Path | foreach-object { $Value1 = $\_.Column1 $Value2 = $\_.Column2 }

My problem lies in now matching $Value1 across to the other CSV's, and pulling $Value3 from them according to the $Value2 data in the first CSV.

Should I use an array of some sort?

&nbsp;

&nbsp;

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [September 2, 2019, 7:01am UTC](https://forums.powershell.org/t/suggestions-for-parsing-editing-csv-files-on-a-per-value-basis/13053/2 "2019-09-02T07:01:39Z")

</div>

I thought we would have been further already … 😉

[https://powershell.org/forums/topic/need-to-match-column-data-across-csvs/#post-173248](https://powershell.org/forums/topic/need-to-match-column-data-across-csvs/#post-173248)

Is this the same issue or is it a new one?

---

<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:31pm UTC](https://forums.powershell.org/t/suggestions-for-parsing-editing-csv-files-on-a-per-value-basis/13053/3 "2024-05-16T20:31:43Z")

</div>

Closed on May 16, 2024, 8:31pm UTC


