Jump to content

_ExcelBookSaveAs CSV File


99ojo
 Share

Recommended Posts

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

Link to comment
Share on other sites

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
Link to comment
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...

Link to comment
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...

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
Link to comment
Share on other sites

  • 5 years later...

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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...