Last active
July 16, 2020 06:38
-
-
Save Winand/956c9f63cea1b3b275c98b3e3f5f7b94 to your computer and use it in GitHub Desktop.
csv to Visio xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$f = Get-Content -Path D:\dat.txt | |
$data = ConvertFrom-Csv -Delimiter "`t" -InputObject $f | |
$data = $data | Sort-Object -Property "Тип заявки", "Объект", "Первичный идентификатор" | |
$groups = $data | Group-Object -Property "Тип заявки" | |
$xmlsettings = New-Object System.Xml.XmlWriterSettings | |
$xmlsettings.Indent = $true | |
foreach ($i in $groups) { | |
$XmlWriter = [System.Xml.XmlWriter]::Create("D:\$($i.Name).xml", $xmlsettings) | |
$XmlWriter.WriteStartDocument() | |
Write-Host "#########", $i.Name, "#########" | |
foreach ($r in $i.Group) { | |
Write-Host $r."Объект", "|", $r."Первичный идентификатор", "|", $r."Процедура" | |
} | |
$XmlWriter.Close() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment