Excel to CSV with UTF8 encoding

2018-12-31 09:02发布

I have an Excel file that has some Spanish characters (tildes, etc.) that I need to convert to a CSV file to use as an import file. However, when I do Save As CSV it mangles the "special" Spanish characters that aren't ASCII characters. It also seems to do this with the left and right quotes and long dashes that appear to be coming from the original user creating the Excel file in Mac.

Since CSV is just a text file I'm sure it can handle a UTF8 encoding, so I'm guessing it is an Excel limitation, but I'm looking for a way to get from Excel to CSV and keep the non-ASCII characters intact.

30条回答
有味是清欢
2楼-- · 2018-12-31 09:10

I know this is an old question but I happened to come upon this question while struggling with the same issues as the OP.

Not having found any of the offered solutions a viable option, I set out to discover if there is a way to do this just using Excel.

Fortunately, I have found that the lost character issue only happens (in my case) when saving from xlsx format to csv format. I tried saving the xlsx file to xls first, then to csv. It actually worked.

Please give it a try and see if it works for you. Good luck.

查看更多
其实,你不懂
3楼-- · 2018-12-31 09:10

A second option to "nevets1219" is to open your CSV file in Notepad++ and do a convertion to ANSI.

Choose in the top menu : Encoding -> Convert to Ansi

查看更多
余生无你
4楼-- · 2018-12-31 09:11
  1. Save xls file (Excel file) as Unicode text=>file will be saved in text format (.txt)

  2. Change format from .txt to .csv (rename the file from XYX.txt to XYX.csv

查看更多
长期被迫恋爱
5楼-- · 2018-12-31 09:12

I've found OpenOffice's spreadsheet application, Calc, is really good at handling CSV data.

In the "Save As..." dialog, click "Format Options" to get different encodings for CSV. LibreOffice works the same way AFAIK.

calc save dialog

查看更多
倾城一夜雪
6楼-- · 2018-12-31 09:13

What about using Powershell.

Get-Content 'C:\my.csv' | Out-File 'C:\my_utf8.csv' -Encoding UTF8
查看更多
怪性笑人.
7楼-- · 2018-12-31 09:17
  1. Save the Excel sheet as "Unicode Text (.txt)". The good news is that all the international characters are in UTF16 (note, not in UTF8). However, the new "*.txt" file is TAB delimited, not comma delimited, and therefore is not a true CSV.

  2. (optional) Unless you can use a TAB delimited file for import, use your favorite text editor and replace the TAB characters with commas ",".

  3. Import your *.txt file in the target application. Make sure it can accept UTF16 format.

If UTF-16 has been properly implemented with support for non-BMP code points, that you can convert a UTF-16 file to UTF-8 without losing information. I leave it to you to find your favourite method of doing so.

I use this procedure to import data from Excel to Moodle.

查看更多
登录 后发表回答