I am trying to export the results of a query to an excel file. I use ssms for my query and I am using PowerShell to get the file.
Invoke-Sqlcmd -ServerInstance "Main" -Database "play" -Query "SELECT * FROM LOG1" | Out-File -FilePath "C:\temp\file.csv" -v
I get I file is a csv format but when I change it to excel it's not supported because the lines dont match