Welcome › Forums › General PowerShell Q&A › CSV: Add New, Update Existing
This topic contains 2 replies, has 2 voices, and was last updated by
I have a psobject that I need to compare against rows stored in a csv. The props are ImageName and File. File is unique, ImageName is not.
If the current File object does not exist in a csv row, add the new row with File and ImageName.
If the csv DOES contain a row that has the current File object, update the ImageName in that row only.
Is this simple? Probably.
Thanks for any suggestions.
What is the source of the new Imagename, and how do you correlate that to a specific filename (that may or maynot be in the CSV file?
The values in ImageName and File come from a an advanced function that generates the output as a psobject.
A File (name) is associated with an ImageName; ImageName can be related to multiple File objects:
I need to update a CSV with this info. If the File already exists in the CSV, update the ImageName associated with it (to avoid duplicates). Otherwise, just add the entire object to the CSV.
I tend to overshoot so this could be a simple thing.
The topic ‘CSV: Add New, Update Existing’ is closed to new replies.