我有一个Excel文件,其中有一些西班牙字符(波浪号等),我需要将其转换为CSV文件作为导入文件使用。然而,当我将另存为CSV时,它会破坏不是ASCII字符的“特殊”西班牙字符。它似乎也这样做的左右引号和长破折号,似乎是来自最初的用户在Mac中创建Excel文件。

由于CSV只是一个文本文件,我确信它可以处理UTF8编码,所以我猜这是Excel的限制,但我正在寻找一种方法,从Excel到CSV,并保持非ascii字符完整。


当前回答

我也有同样的问题,遇到了这个添加,它在excel 2013中工作得很好,除了excel 2007和2010,它是提到的。

其他回答

“nevets1219”是正确的谷歌文档,然而,如果你只是“导入”文件,它通常不会将其转换为UTF-8。

但是如果您将CSV导入到现有的谷歌电子表格中,它会转换为UTF-8。

下面是一个食谱:

在主文档(或驱动器)屏幕上点击“创建”按钮并选择“电子表格” 在“文件”菜单中选择“导入” 按“选择档案” 选择“替换电子表格” 选择要用作分隔符的字符 点击“导入” 从“文件”菜单选择“下载为”-> CSV(当前文件)

生成的文件将是UTF-8格式的

使用notepad++打开.csv文件。如果你看到你的编码是好的(你看到所有字符,因为他们应该)按编码,然后转换为ANSI Else -找出当前的编码

我也有同样的问题,遇到了这个添加,它在excel 2013中工作得很好,除了excel 2007和2010,它是提到的。

Easy way to do it: download open office (here), load the spreadsheet and open the excel file (.xls or .xlsx). Then just save it as a text CSV file and a window opens asking to keep the current format or to save as a .ODF format. select "keep the current format" and in the new window select the option that works better for you, according with the language that your file is been written on. For Spanish language select Western Europe (Windows-1252/ WinLatin 1) and the file works just fine. If you select Unicode (UTF-8), it is not going to work with the spanish characters.

你可以在没有第三方软件的现代Windows机器上做到这一点。这种方法是可靠的,它可以处理包含引号逗号、引号制表符、CJK字符等的数据。

1. 从Excel中保存

在Excel中,使用Unicode文本(*.txt)类型将数据保存到file.txt。

2. 开始PowerShell

从开始菜单运行powershell。

3.在PowerShell中加载文件

$data = Import-Csv C:\path\to\file.txt -Delimiter "`t" -Encoding BigEndianUnicode

4. 将数据保存为CSV格式

$data | Export-Csv file.csv -Encoding UTF8 -NoTypeInformation