.csv file output from Powershell is displayed in one column in Excel

Lately on some Windows 10 machines I noticed that Get-Service | Export-Csv "C:\users\[xxx]" creates a .csv file that if opened in Excel displays all properties just in column A. I'm used to seeing each property being output to a separate column.

The Windows and Office versions on both machines are identical. Windows: 1709 (Build 16299.431) Office: 1802 (Build 9029.2253 CTR)

Excel-Online also displays the output in one column.

Right-clicking the .csv file on each machine shows diffrent file types: "CSV-File (.csv)" which displays multiple columns versus "Microsoft Excel-CSV-File(.csv)" which opens in one column.

Moreover, the file icons are different.

enter image description here for the machines where it displays multiple columns and enter image description here for machines where it displays in one column.

Has anybody experienced this and knows why that might be?

I'm consfused as to which is the correct behaviour.

Thanks for your input.

1 answer

  • answered 2018-07-12 07:35 Paxz

    Export-CSV uses , to seperate columns, while excel wants ; as seperators.

    The easiest way for you to handle the situation is to use this instead:

    Export-Csv "C:\users\[xxx]" -Delimiter ';'

    This will create the .csv file with ; instead of ,.

    You probaly have different default delimiters on the two machines, the answer here explains it pretty well: How to get Excel to interpret the comma as a default delimiter in CSV files?