Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Etract data to Excel

$
0
0

Good day im a newbie

i have a text file (LOG.TXT )that contain the following info below.


S e r i a l N u m b e r      M X L 1 0 3 0 8 3 4          TW-BW-JU-IT-12

S e r i a l N u m b e r      M X L 1 0 3 0 9 2 5           TW-BW-JU-IT-13

S e r i a l N u m b e r      M X L 1 0 3 0 9 5 9          TW-BW-JU-IT-14

i want to export this info to a Excel file using Powershell  , Maintainting the same row and column structure .

 i WAS TRYIN TO USE THE SCRIPT BELOW . BUT IT ISNT OUTPUTING CORRECTLY.

$path = "C:\Users\\Desktop\logStroe\LOG.txt"
$outPath = $path -replace ".txt",".xls"
Get-Content -path $path |
ForEach-Object {$_ -replace " ","," } |  
Out-File -filepath $outPath


Viewing all articles
Browse latest Browse all 21975

Trending Articles