update a csv file

Welcome Forums General PowerShell Q&A update a csv file

This topic contains 3 replies, has 3 voices, and was last updated by

 
Participant
3 months ago.

  • Author
    Posts
  • #146189

    Participant
    Topics: 7
    Replies: 7
    Points: 102
    Rank: Participant

    hello ladies & gents,

    a new day, a new problem 😉

    I need to update an existing CSV file by pulling some information on computers and adding that info to the csv file. This script will run on thousands of computers and each computer adds its info to the file. I'm testing on 3 only for now.

    So far, everything works fine except a detail that I do not know how to fix: for each line that my script adds to the file, the column titles are repeated. which gives something like:

    PC Name – App Name – Version

    PC1 – Adobe Reader – 11.0.12

    PC Name – App Name – Version

    PC2 – Adobe reader – 11.0.15

    ….

    How can I write only the values to the csv?

    thank you!

  • #146196

    Participant
    Topics: 1
    Replies: 1374
    Points: 1,884
    Helping Hand
    Rank: Community Hero

    Without seeing your code we could only take a vague guess what's wrong in your code. So you will have to show it here. 😉 You can edit your initial post and add the code – formatted as code please.

  • #146213

    Moderator
    Topics: 8
    Replies: 891
    Points: 2,749
    Helping Hand
    Rank: Community Hero

    I think you are doing string building to create a csv file, this will be very simple in PowerShell way. But like @olaf-soyk mentioned, without seeing your code it's very difficult to help. If original code sharing is not possible, you can share a sample code which is similar to you actual code.

  • #146550

    Participant
    Topics: 7
    Replies: 7
    Points: 102
    Rank: Participant

    I think you are doing string building to create a csv file, this will be very simple in PowerShell way. But like @olaf-soyk mentioned, without seeing your code it's very difficult to help. If original code sharing is not possible, you can share a sample code which is similar to you actual code.

    you gave me the hint I needed, it now works as I want. I managed the data as a string and it now correctly reports to the csv file.

    thanks!

The topic ‘update a csv file’ is closed to new replies.