
Excel will still recognise the carriage return character ( \r) to separate records. Remove the newline/linefeed characters ( \n with Notepad++).
#Excel for osx insert lf in cell windows
I've used Windows line-endings (\r\n) both in the text field and as a record separator, that works.You must quote fields that contain a newline with the " character.Perhaps other characters work, but I don't know which. You must use a comma or a semicolon separator, but not the one that is the decimal separator in your Regional Settings.I tried UTF-8 without BOM (can be switched easily in Notepad++), but then double-clicking the document fails. The file must be saved as UTF-8 with a BOM, which is what Notepad does when you chose UTF-8.So all the details that I've been able to gather to get this to work are: If you want to publish this CSV online and users may have Excel, I guess you have to publish both versions and suggest that people check which file gives the correct number of rows. I have access to another computer set to UK English locale, and on that computer, the first example with a comma separator works fine (only on doubleclick), and the one with semicolon actually fails! So much for interoperability. Excel seems to avoid this character and prefer a semicolon instead. In Norway, comma is the decimal separator. If I try to import data from text and chose this CSV, then it still fails on quoted newlines.īut there's another catch! The working field separator (comma in the original example, semicolon in my case) seems to depend on the system's Regional Settings (set under Control Panel -> Region and Language). So I changed the example to look like this, and chose the UTF-8 encoding when saving in Notepad: ID Name Descriptionīut there's a catch! The only way it works is if you double-click the CSV file to open it in Excel.

I didn't change anything else, and it just worked. Changing the commas to semicolons worked for me, though.

I chose UTF-8 as suggested, but with no luck. I wrote it in Notepad and chose Save as., and next to the Save button you can choose the encoding. I don't have Excel 2007, but I have Excel 2010, and the example given: ID,Name,Descriptionĭoesn't work. It seems to be locale dependent (which seems idiotic, in my humble opinion). It does a much better job of stuff like this than any version of Excel I've tried, and it can save to XLS or XLSX as required if you need to transfer to Excel afterwards.īut if you're stuck with Excel and need a better fix, there seems to be a way.

#Excel for osx insert lf in cell download
If you are doing this manually, download LibreOffice and use LibreOffice Calc to import your CSV. It's just the line breaks that are causing problems. Note that the comma in "Smith, Joe" is being handled properly. When I import this into Excel 2007, I end up with a header row, and two records. Here's a quick file I wrote by hand to duplicate the problem. Has anyone else encountered this behavior, and if so, how did you fix it?

I've also tried replacing CR/LF (\r\n) with just CR (\r), and again with just LF (\n), but no luck. However, when I import the data into Excel 2007, set the appropriate delimiter, and set the text qualifier to double quote, the line breaks are still creating new records at the line breaks, where I would expect to see the entire text field in a single cell. In order to counteract this, I have wrapped the field in double quotes ("). One of the fields is a free-text field, which may contain line breaks, commas, quotations, etc. I'm working on a feature to export search results to a CSV file to be opened in Excel.
