Sign in to follow this  
Followers 0
99ojo

_ExcelBookSaveAs CSV File

6 posts in this topic

Hi,

I use _ExcelBookSaveAs to save several sheets as csv file.

The german äüöß are saved as "á„. So i have problems with import. It looks like ANSI-ASCII problem.

If you use the save as option from excel with option CSV (....) (*.csv) everything is o.k.

If you use the save as option from excel to save with option CSV (MS-DOS) (*.csv) the same thing happens as if i use _ExcelBookSaveAs.

It seemed that _ExcelBookSaveAs uses MS-DOS format for saving excel files as csv file.

Does anyone know how to change?

;-((

Stefan

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hi,

I use _ExcelBookSaveAs to save several sheets as csv file.

The german äüöß are saved as "á„. So i have problems with import. It looks like ANSI-ASCII problem.

If you use the save as option from excel with option CSV (....) (*.csv) everything is o.k.

If you use the save as option from excel to save with option CSV (MS-DOS) (*.csv) the same thing happens as if i use _ExcelBookSaveAs.

It seemed that _ExcelBookSaveAs uses MS-DOS format for saving excel files as csv file.

Does anyone know how to change?

;-((

Stefan

Hi,

got it by myself.

Following changes in excel.au3:

Constants section:

Const $xlCSVWindows = 23

Function _ExcelBookSaveAs

If $sType = "xls" Or $sType = "csv" Or $sType = "txt" Or $sType = "template" Or $sType = "html" or $sType = "csvWin"  Then
        If $sType = "xls" Then $sType = $xlNormal
        If $sType = "csv" Then $sType = $xlCSVMSDOS
        If $sType = "csvWin" Then $sType = $xlCSVWindows
        If $sType = "txt" Then $sType = $xlTextWindows
        If $sType = "template" Then $sType = $xlTemplate
        If $sType = "html" Then $sType = $xlHtml
    Else

So i call _ExcelBookSaveAs ($oExcel, $sFilePath, "csvWin") and it works.

;-))

Stefan

Edited by 99ojo

Share this post


Link to post
Share on other sites

You mean the filename äüöß is changed to another_string.csv? If so, I've found a problem with the encoding option of SciTE, at least over here, that does not mark the file's structure as an UTF-8 encoded file. What I've did, was to close it, open it in notepad, save it as UTF-8 and reopen it in SciTE. The first time you'll run or check the file, the SciTE output pane should nicely markup with red section that you're using unicode format or something...

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

You mean the filename äüöß is changed to another_string.csv? If so, I've found a problem with the encoding option of SciTE, at least over here, that does not mark the file's structure as an UTF-8 encoded file. What I've did, was to close it, open it in notepad, save it as UTF-8 and reopen it in SciTE. The first time you'll run or check the file, the SciTE output pane should nicely markup with red section that you're using unicode format or something...

Hi,

no. I'm saving excelsheet to csv file to get the data for import.

In the cells, some names included german 'umlaute' : ä ö ü

Excelsheet looks like:

Name Vorname (1st Row Excel)

Mühle Jörg (2nd Row Excel)

Former: _ExcelBookSaveAs ($oExcel, $filename, "csv") the result is Mhle;J”rg; in csv file.

Now: _ExcelBookSaveAs ($oExcel, $filename, "csvWin") the result is Mühle;Jörg; in csv file.

We are using the csv export to import the data into a mysql db.

;-))

Stefan

Edited by 99ojo

Share this post


Link to post
Share on other sites

Hi Stefan,

Know you posted this over 5yrs ago, but just wanted to say thanks!  I had the same issue with the norwegian æåø characters converting to csv.  This did the trick.

Daniel

Share this post


Link to post
Share on other sites

Your message won't reach the user. He has not been online for about 4 years ;)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0