I am using SQLCMD command in PowerShell to run SQL scripts. When I pipe the output to TXT, the formatting is all messed up. I want to export the results to an Excel file. How can I do that?
My command
Sqlcmd -Q 'select top 10 * from people' -S serverName -d testDB -o c:\output.txt | format-table