Skip to content

Instantly share code, notes, and snippets.

@Winand
Last active July 16, 2020 06:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Winand/956c9f63cea1b3b275c98b3e3f5f7b94 to your computer and use it in GitHub Desktop.
Save Winand/956c9f63cea1b3b275c98b3e3f5f7b94 to your computer and use it in GitHub Desktop.
csv to Visio xml
$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