Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

_Excel_BookSaveAs CSV file as XLS on german machine

$
0
0

Hi

 

I have a csv file with coma delimiter columns that needs to be converted to '.xls' format

On English locale its works perfectly (each data line separated by comma get its own column cell in the excel sheet)

The problem is that on German locale it is not working. The xls contain single column only in the excel sheet.

The UDF function _Excel_BookSaveAs does not save it as expected.

How to resolve that issue?

 

Here is the function that I am using:

AutoIt         
Func CreateXLSFromCSV($sFilePath)     Local $sDrive = "", $sDir = "", $sFileName = "", $sExtension = ""     Local $Parame = ""     Local $aPathSplit, $sWorkbook     Local $oAppl     $oAppl = _Excel_Open(False)     If @error Then         MsgBox($MB_SYSTEMMODAL, "CreateXLSFromCSV ", "Error openning Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended)         _Excel_Close($oAppl)         Return SetError(1, 1, "")     EndIf     $oWorkbook = _Excel_BookOpenText($oAppl, $sFilePath)     If @error Then         MsgBox($MB_SYSTEMMODAL, "CreateXLSFromCSV", "Error opening text " & @ScriptDir & "\" & $sFilePath & @CRLF & "@error = " & @error & ", @extended = " & @extended)         _Excel_Close($oAppl)         Return SetError(2, 2, "")     EndIf     $sWorkbook = StringTrimRight($sFilePath, 4) & ".xls"     _Excel_BookSaveAs($oWorkbook, $sWorkbook, 56, True)  ;56     ;_Excel_BookSaveAsEx($oWorkbook, $sWorkbook, 56, True)     If @error Then         MsgBox($MB_SYSTEMMODAL, "CreateXLSFromCSV", "Error saving workbook to '" & $sWorkbook & "'." & @CRLF & "@error = " & @error & ", @extended = " & @extended)         _Excel_Close($oAppl)         Return SetError(3, 3, "")     EndIf     _Excel_Close($oAppl)     Return $sWorkbook EndFunc   ;==>CreateXLSFromCSV

Viewing all articles
Browse latest Browse all 12506

Trending Articles