$data = Import-Csv -Path $_.FullName -Header Title, Acode, FirstName, LastName ( Formatting xml fields from a csv with powershell) foreach ($router in $routers). I have found a code snippet with something similar and I've been playing around with it, but I am not sure how to integrate this in my current code. Rename-Item -NewName "$($_.BaseName).xml" -Path $_.FullName Set-Content -Path $_.FullName -Encoding UTF8 Get-ChildItem -Path 'C:\Users\somename\Desktop\FOLDER\Output\' | #Converts all items from output folder to XML # Imports CSV file, exports as CSV to the desired destinationĮxport-Csv -Path $filePathDest –NoTypeInformation # Combines destination folder and file name # Combines source folder path and file name # Generate a list of all files in the folder and pipe it to ForEach-Object $folderPathDest = 'C:\Users\somename\Desktop\FOLDER\Output\' $folderPath = 'C:\Users\somename\Desktop\FOLDER\Import\' I have managed to pick up all CSV files, move them to a folder and "rename to XML" using the code below. #Desired XML file format (I would like to be able to pull the data from the CSV files straight into the XML values) #CSV files format (No headers) booker12,9012,Rachel,Booker I am trying to loop through a folder, import all CSV files, transform them to XML, change the XML values according to the CSV data and export them to a different folder while keeping the same name.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |