How do you force excel to quote all columns of a CSV file?
This page also has the solution which comes straight from the horse's mouth:
http://support.microsoft.com/kb/291296/en-us
If the link degrades, the topic to search for is:
"Procedure to export a text file with both comma and quote delimiters in Excel" and/or "Q291296"
tl;dr: use their macro
If you open the XLS file in LibreOffice or OpenOffice, then Save As....and choose Text CSV, it alows generating a CSV file that also includes quotes as delimiters. E.g.: "Smith","Pete","Canada" "Jones","Mary","England"
Just check the "Quote all text cells" box:
In order to also quote numeric fields, highlight your cell range and change the cell formatting to "text" prior to saving.
I found this easy solution:
- Highlight the cells you want to add the quotes.
- Right click and go to: Format Cells → Tab: Number → Category: Custom
- Paste the following into the Type field:
"''"@"''"
(see details below) - Click “okay”
The string you are pasting is "''"@"''"
which is double quote, single quote, single quote, double quote, @ symbol, double quote, single quote, single quote, double quote.
Edited for Excel 2010 from the information found here.
Powershell appears to dump correctly. so something like
search for powershell.exe on windows machine if you dont know powershell.
import-csv C:\Temp\Myfile.csv | export-csv C:\Temp\Myfile_New.csv -NoTypeInformation -Encoding UTF8
Hope it helps someone.