I have a script that converts from xls to csv. It is very simple and simple to open xls with an Excel object and save it as csv:
cls Remove-Item *.csv $stringBuilder = New-Object System.Text.StringBuilder $objExcel = New-Object -ComObject Excel.Application $objExcel.Visible = $false $Tab = [char]9 $Pestana = 2
$Archivo = $Linea.FullName
$ArchivoCorto = $Archivo.Replace('.xlsx','')
"Procesando: "+$Archivo
$WorkBook = $objExcel.Workbooks.Open($Archivo,$null,$True)
$WorkSheet = $WorkBook.sheets.item($Pestana)
$WorkSheet.SaveAs($ArchivoCorto+".csv", 23)
$WorkBook.Close($False)
$objExcel.Quit()
The strange thing is that the result of csv is divided by ,when I want to be shared with ;.
If I do (Get-Culture).TextInfo.ListSeparator, I get ;.
I also have the same separator in the regional and language settings on the control panel.
If I take the same Excel and save manually, the resulting csv will be split into ";".
source
share