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.
Save Dialog > Tools Button > Web Options > Encoding Tab
Microsoft Excel has an option to export spreadsheet using Unicode encoding. See following screenshot.
For those looking for an entirely programmatic (or at least server-side) solution, I've had great success using catdoc's xls2csv tool.
Install catdoc:
Do the conversion:
This is blazing fast.
Note that it's important that you include the
-d utf-8
flag, otherwise it will encode the output in the defaultcp1252
encoding, and you run the risk of losing information.Note that
xls2csv
also only works with.xls
files, it does not work with.xlsx
files.easiest way: no need Open office and google docs
dont open it with Ms-office anyway!!! Now you have a tab delimited CSV file.
I have written a small Python script that can export worksheets in UTF-8.
You just have to provide the Excel file as first parameter followed by the sheets that you would like to export. If you do not provide the sheets, the script will export all worksheets that are present in the Excel file.
A simple workaround is to use Google Spreadsheet. Paste (values only if you have complex formulas) or import the sheet then download CSV. I just tried a few characters and it works rather well.
NOTE: Google Sheets does have limitations when importing. See here.
NOTE: Be careful of sensitive data with Google Sheets.
EDIT: Another alternative - basically they use VB macro or addins to force the save as UTF8. I have not tried any of these solutions but they sound reasonable.