Welcome to WebmasterWorld Guest from

Forum Moderators: travelin cat

Message Too Old, No Replies

Carriage return problem - need to import into website

Excel data has extra new line characters

5:19 pm on Nov 26, 2003 (gmt 0)

Junior Member

10+ Year Member

joined:July 22, 2003
votes: 0

I need to export data from Excel into a txt file, the text file is used to update my websites database. I have done this on my fiends PC like this:

1) Copying all the cells
2) Opening a new text file - using notepad
3) Paste the lot into notepad

On my Mac I do this and the first Excel row is OK but after that I have new line characters causing line breaks. This causes my products import to fail. It is as if word wrap was on or I had set the column width in Outlook (you know how emails look when a column width is set.

Any suggestions?

Thanks for your help.

11:07 pm on Nov 28, 2003 (gmt 0)

Junior Member

10+ Year Member

joined:Apr 10, 2002
votes: 0

What are you using for the "notepad" on the Mac? Could you simply "Save As.." from Excel? What format do the data need to be in? Since you are using notepad, I assume this is a Windows server? It should have a carriage return and line feed to distinguish lines. You have either a carriage return OR a line feed when you use something on a Mac (depends on what app you are using). Use BBedit or BBedit Lite on the Mac and choose "DOS" file format.
6:42 pm on Dec 1, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Aug 1, 2003
votes: 0

Mac OS X is schizophrenic when it comes to line endings. Mac apps like Excel use carriage returns like Mac OS 9 (ASCII: 13), but Unix tools like Apache, PHP, etc., recognize line feeds like Unix does (ASCII: 10).

(FYI, Windows uses both: CR then LF. This sometimes ends up looking like "extra" line breaks.)

As the other poster mentioned, BBEdit is a great tool to fix this. Should be just: open the file and save it, choosing Options...Line Breaks...<desired platform>.

8:24 pm on Dec 1, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 8, 2002
votes: 0

Agreed 100% - BBEdit is a must and fixes all these little problems. However, if you save the Excel file through Excel on Mac as tab delimited text file, all the line breaks are allready ok so you won't need BBEdit (sigh).

(Just ignore the Excel message that all formatting will be lost. You know this - you want this. With these silly Excel alerts, just always remember Excel is a MS product so it always asks you if you really want to do what you want to do. :P)