T
T
TechNOIR2017-03-02 13:13:20
PowerShell
TechNOIR, 2017-03-02 13:13:20

Powershell. How to export the resulting array to Excel?

Good afternoon.
Parsing with Powershell+Selenium.
Using the command $fullstory = $ie.FindElementByClassName("comment")
Get output:

Исполнитель: Pink Floyd
Название альбома: Dark Side Of the Moon
Стиль: Rock
Год выпуска: 2016

How to make Excel output so that respectively "Artist:", "Album name:", etc. become columns, and what after the colon - column values?
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Denis, 2017-03-02
@TechNOIR

Not exactly the same, but I think it can be adapted to your needs:
Some shit code

T
TechNOIR, 2017-03-03
@TechNOIR

Helped solve a problem on Technet.
I am attaching the solution in the hope that it will be useful to someone.
Module for Excel: https://github.com/dfinke/ImportExcel

$h = Write-Output Стиль,Формат,"Год выпуска",Размер,"Название альбома",Исполнитель
$data = $fullstory.text.split("`n") -replace ": ","=" | Where {$_.Trim()} | Out-String | ConvertFrom-StringData | Foreach {[pscustomobject]$_}
$data | Select $h | Export-Excel file.xlsx -AutoSize

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question