csv with excel
Um zu verhindern, dass auf unterschiedlichen Systemen die unterschiedlichen Standard-csv-Delimiter nicht korrekt erkannt werden, hat sich folgendes bewährt.
- Format UTF16-LE (aka Windows Unicode)
- Delimiter TAB
Beispiel:
1
2
3
4
5
6
$IDV_Extensions = @()
$IDV_Extensions += [pscustomobject]@{'foo' = 1; 'bar' = 2}
$IDV_Extensions += [pscustomobject]@{'foo' = 2; 'bar' = 4}
$IDV_Extensions | select-object foo, bar `
| Export-Csv -Delimiter "`t" -Encoding Unicode `
-Path .\test.csv -NoTypeInformation
P.S.: theoretisch ginge auch ein CSV mit der Angabe
sep=;
aber das führt bei Sonderzeichen (Umlaute etc.) zu Problemen.
Anmerkung: bei Zahlen, die als String formatiert werden sollen, muss mehrfach gequoted sein aka „=““0011″““
1
2
3
4
5
6
$IDV_Extensions = @()
$IDV_Extensions += [pscustomobject]@{'foo' = "=`"0011`""; 'bar' = 2}
$IDV_Extensions += [pscustomobject]@{'foo' = "=`"0023`""; 'bar' = 4}
$IDV_Extensions | select-object foo, bar `
| Export-Csv -Delimiter "`t" -Encoding Unicode `
-Path .\test.csv -NoTypeInformation
Dieser Eintrag ist vom Autor unter
CC BY 4.0
lizensiert.