Powershell: Excel zu CSV - Trennzeichen ändern??
Moin!
Wie bekomm ich die Powershell dazu, die Excel Tabelle nicht mit Komma, sondern mit Semikolon Trennzeichen als CSV zu exportieren?
Mein bisheriger Code:
Was muss ich wo anpassen????
Wie bekomm ich die Powershell dazu, die Excel Tabelle nicht mit Komma, sondern mit Semikolon Trennzeichen als CSV zu exportieren?
Mein bisheriger Code:
function Export-ExcelCSV{
[CmdletBinding()]
Param(
$ExcelWorkbook="$pwd\Test.xlsx",
$WorksheetName='Tabelle1'
)
Try{
Add-Type -AssemblyName Microsoft.Office.Interop.Excel
$xl=New-Object -ComObject Excel.Application
[void]$xl.Workbooks.Open($ExcelWorkbook)
$xl.Worksheets.Item($WorksheetName).Select()
$fi=[io.fileinfo]$xl.ActiveWorkbook.FullName
$csvfile=$fi.FullName.Replace($fi.Extension,'.csv')
Write-Verbose "Saving CSV to $csvfile"
$xl.ActiveSheet.SaveAs($csvFile,[Microsoft.Office.Interop.Excel.XlFileFormat]::xlCSV)
$xl.Quit()
}
Catch{
Throw $_
}
While([System.Runtime.Interopservices.Marshal]::ReleaseComObject($xl)){}
}
Export-ExcelCSV -Verbose
Was muss ich wo anpassen????
Please also mark the comments that contributed to the solution of the article
Content-Key: 289988
Url: https://administrator.de/contentid/289988
Printed on: April 26, 2024 at 09:04 o'clock
3 Comments
Latest comment
Den Funktions-Parameter Local bei der SaveAs-Funktion auf True setzen, wenn die lokalen Regions-Einstellungen Deutsch sind.
https://msdn.microsoft.com/de-de/library/microsoft.office.tools.excel.wo ...
Gruß grexit
https://msdn.microsoft.com/de-de/library/microsoft.office.tools.excel.wo ...
.SaveAs($csvFile,6,$null,$null,$null,$null,$null,$null,$null,$null,$null,$true)