import text-file - strings contain cr-lf

J

John A Grandy

I have a text-file I wish to import into an Excel spreadsheet.

This file's data-fields are comma-separated. Data-fields which contain text
are quote-delimited .... but the text-data-fields can contain CR-LF.

Excel's Data > Get External Data > Import Text File menu option will see
each such CR-LF as starting a new row -- which I don't want.

Has anyone worked-up a solution for this kind of import problem ?
 
J

Jim Rech

I'd look at manipulating the data once it's in a worksheet, if possible. If
it is not possible then you may have to use VB's low level file i/o
functions. If you haven't worked with them it can be a challenging
experience but you can get the byte-by-byte control that you want.

This is a pretty good article on the subject:

http://support.microsoft.com/default.aspx?scid=/support/excel/content/fileio/fileio.asp

You might look at using Line Input and parsing/concatenating according to
your needs.
 
P

Peter Beach

Hi John,

What version of XL are you using? Certainly XL 2000 doesn't exhibit the
behaviour you mention. For me XL correctly ignores the CR-LF (and for that
matter commas etc) that appear within quotes.

Regards,

Peter Beach
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top