How can I save a csv with utf-8 encoding using Excel 2013?

Anonymous
2013-07-30T10:03:03+00:00

Hi!

I would like so save a csv file from an Excel 2013 sheet with utf-8 encoding. I have not seen an option for this in the user interface. However there is an option after pressing save under the tools dropdown list / webalternatives / encoding. But if I select utf-8 there it has no effect.

Does someone know how to do this?

/Peter

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
Answer accepted by question author
Anonymous
2014-04-16T12:39:31+00:00

One easy way to change excel ANSI encoding to UTF-8 is the open the .csv file in notepad then select File > Save As. Now at the bottom you will see encoding it set to ANSI change it to UTF-8 and save the file as new file and then your done. If someone has a program or script that can do this without notepad I sure would like to know how.

Hope this info helps someone.

Was this answer helpful?

100+ people found this answer helpful.
0 comments No comments

33 additional answers

Sort by: Most helpful
  1. Anonymous
    2016-04-10T21:33:29+00:00

    Hey,

    you can save Excel-Sheets with UTF-8 Encoding directly in Excel and don't need any workarounds. This option is just very well hidden:

    1. Save As...
    2. Select "Tools" and then "Weboptions"

    3. Select "UTF-8" in the Tab "Encoding"

    This already works in Excel 2010.

    I hope it will help you.

    ~Thomas

    Was this answer helpful?

    7 people found this answer helpful.
    0 comments No comments
  2. Anonymous
    2014-05-30T07:24:31+00:00

    One easy way to change excel ANSI encoding to UTF-8 is the open the .csv file in notepad then select File > Save As. Now at the bottom you will see encoding it set to ANSI change it to UTF-8 and save the file as new file and then your done. If someone has a program or script that can do this without notepad I sure would like to know how.

    Hope this info helps someone.

    I don't understand how this can work, can someone advise When I save an Excel file in CSV format, the non-ASCII characters get garbled and cannot be re-encoded as UTF-8. For example:

    ウイグル族2人手

    becomes

    _____2__

    I'm using Excel for Mac 2011.

    Steven,

    Something you may want to try is saving as 'Unicode Text' format. This creates a tab-delineated file in UTF-16LE (I believe), which is easily converted to UTF-8 if preferred.

    Once you have a tab-delineated file, you can convert it to CSV with some ease, depending on the complexity of the cell values. The way I do it, for example, is to open the .txt file in Notepad++ and go through a few steps:

    1. Replace any double-quote marks (") with escaped versions (", or "", depending on how your CSV will be parsed)
    2. Replace all of the tab spaces with double quote-comma-double quote (",")
    3. Add a double quote to the beginning and end of each line. I'm lazy so I just 'replace' every line break (\n, or \r\n, depending on environment) with a line break surrounded by double quotes (ex., "\n"). That might get weird if you have cells with line breaks in them, so be cautious.

    It'd be a small task to set up a macro that can do these replaces quickly and less crudely. You'll find some guides online that talk about using the Unicode Text format and just replacing the tabs with commas--don't do it unless the cell values are simple. If a single cell has a string with a comma in it, you've now got a broken value. That's why I recommended using commas surrounded by quotes. Once each value is in quotes, the only character that should be able to screw things up is another double quote. Good thing we replaced those with escaped versions in the beginning, yeah?

    If You Just Want It To Work

    I keep a copy of Gnumeric installed literally for just this purpose. It can open Excel files, and saves as UTF-8 CSV files out-of-the-box. I'll save my Excel sheet in Excel 95 format, just because it makes me feel more confident about using a 3rd party spreadsheet tool, open it in Gnumeric, and save it as a CSV. Works the first time, every time.

    Was this answer helpful?

    7 people found this answer helpful.
    0 comments No comments
  3. Anonymous
    2014-12-14T15:57:35+00:00

    to whom it may concern...

    a vba code,

    data in active sheet,

    expected results in path - file "c:\tmp\abcd.csv"

    Sub ActiveSheet_to_csv_utf8()

    'Dec 14, 2014

    Const sDelim As String = ","   '<< select comma or semicolon

    Dim ws As Worksheet

    Set ws = ActiveSheet

    Dim r As Long, c As Long, i As Long, j As Long

    r = ws.Cells.Find(What:="*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row

    c = ws.Cells.Find(What:="*", SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).Column

    Dim v() As Variant

    ReDim v(1 To c)

    Dim sFile As String

    sFile =  "c:\tmp\abcd.csv" '<< change

    Dim obj As Object

    Set obj = CreateObject("ADODB.Stream")

    obj.Type = 2

    obj.Charset = "utf-8"

    obj.Open

    For i = 1 To r

    For j = 1 To c

    v(j) = ws.Cells(i, j).Text  ' << or  .Value

    Next

    obj.WriteText Join(v, sDelim), 1

    Next

    obj.SaveToFile sFile, 2

    Dim Npad As Variant

    Npad = Shell("C:\WINDOWS\notepad.exe " & sFile, 1)

    End Sub

    note

    csv file is open via notepad

    check encoding:

    select... File > Save As (you can see encoding: UTF-8 )

    select... Cancel

    close Notepad

    xxxxxxxxxxxxxxxxxxxxxxx

    [update Apr 21, 2016]

    also,

    convert active sheet to csv file

    on desktop, in a folder named: yyyymmdd_hhmmss

    csv file name: activesheet name

    Sub ActiveSheet_to_csv_utf8_02()

     'Apr 21, 2016

     Const sDelim As String = ","   '<< select comma or semicolon

     Dim ws As Worksheet

     Set ws = ActiveSheet

    Dim sFile As String

    sFile = "c:\users\Tasos\Desktop" & Format(Now, "yyyymmdd_hhmmss") '<< change path

    MkDir sFile

    sFile = sFile & "" & ws.Name & ".csv"

     Dim r As Long, c As Long, i As Long, j As Long

     r = ws.Cells.Find(What:="*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row

    c = ws.Cells.Find(What:="*", SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).Column

    Dim v() As Variant

    ReDim v(1 To c)

     Dim obj As Object

     Set obj = CreateObject("ADODB.Stream")

     obj.Type = 2

     obj.Charset = "utf-8"

     obj.Open

    For i = 1 To r

     For j = 1 To c

     v(j) = ws.Cells(i, j).Text  ' << or  .Value

    Next

     obj.WriteText Join(v, sDelim), 1

     Next

     obj.SaveToFile sFile, 2

     Dim Npad As Variant

     Npad = Shell("C:\WINDOWS\notepad.exe " & sFile, 1)

     End Sub

    Was this answer helpful?

    3 people found this answer helpful.
    0 comments No comments
  4. Anonymous
    2013-08-07T02:25:16+00:00

    Hi Joshua,

    UTF-8 is an encoding set that can contain any Unicode character. Unfortunately, not all applications can encode files in UTF-8 by default, and Microsoft Excel is one of them.

    Instead of Unicode, Excel encodes CSV files using ANSI.

    Hope this information is helpful.

    Was this answer helpful?

    3 people found this answer helpful.
    0 comments No comments