Advertisement
upz

Csv to Excel

upz
Jul 11th, 2018
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     #Denne linie skal køres engang i en elevated prompt
  2.     Install-Module -Name importexcel
  3.    
  4.    
  5.     #Resten er lige til, herfra kan udbygges med loops, auto configs og hvad man ellers måtte ønske
  6.     $Destination = "c:\path\that\you\want"
  7.     $DestinationFile = "testfile.xlsx"
  8.     $CSVPath = "c:\datapath\data.csv"
  9.    
  10.     $Data = Import-Csv -Delimiter ';' -Encoding UTF8 -LiteralPath $CSVPath
  11.    
  12.     $ExportSettings = @{
  13.         'path' = "$Destination\$DestinationFile"
  14.         'WorkSheetname' = "test"
  15.     }
  16.    
  17.     Export-Excel @ExportSettings -TargetData $Data
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement