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

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


当前回答

看起来很有趣,我发现将180MB的电子表格保存到UTF8 CSV文件中最简单的方法是将单元格选择到Excel中,复制它们,并将剪贴板的内容粘贴到SublimeText中。

其他回答

“nevets1219”的第二个选项是在notepad++中打开CSV文件并将其转换为ANSI。

在顶部菜单中选择: Encoding ->转换为Ansi

我也遇到过同样的问题,但有一个简单的解决方案。

在Excel 2016或更高版本中打开xlsx文件。 在“另存为”中选择此选项:"(CSV UTF-8(逗号分隔)*.csv)"

它工作完美,并生成一个csv文件,可以导入到任何软件。我在我的SQLITE数据库中导入了这个csv文件,它与所有unicode字符完好无损地完美工作。

简单的方法: 不需要Open office和谷歌文档

Save your file as "Unicode text file"; now you have an unicode text file open it with "notepad" and "Save as" it with selecting "utf-8" or other code page that you want rename file extension from "txt" to "csv". This will result in a tab-delimited UTF-8 csv file. If you want a comma-delimited file, open the csv file you just renamed and replace all tabs with commas. To do this in Notepad on Win 10, simply select one tab field then click Ctrl+H. In the window that opens, type a comma , in the "Replace with" field then click "Replace All". Save your file. The result will be a comma-delimited UTF-8 csv file.

不管怎样,不要用ms office打开它!! 现在您有了一个以制表符分隔的CSV文件。 或者,如果应用步骤5,则使用逗号分隔。

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

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

下面是一个食谱:

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

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

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.