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

Welcome Forums General PowerShell Q&A Suggestions for parsing/editing CSV files on a per-value basis?

This topic contains 1 reply, has 2 voices, and was last updated by

2 weeks, 5 days ago.

  • Author
  • #172853

    Topics: 8
    Replies: 17
    Points: 127
    Rank: Participant

    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.


    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



    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?



  • #174160

    Topics: 1
    Replies: 1530
    Points: 2,591
    Helping Hand
    Rank: Community Hero

    I thought we would have been further already ... 😉

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

You must be logged in to reply to this topic.