ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   import text-file - strings contain cr-lf (https://www.excelbanter.com/excel-programming/275224-import-text-file-strings-contain-cr-lf.html)

John A Grandy

import text-file - strings contain cr-lf
 
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 ?



Jim Rech

import text-file - strings contain cr-lf
 
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...eio/fileio.asp

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

--
Jim Rech
Excel MVP



Peter Beach

import text-file - strings contain cr-lf
 
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

"John A Grandy" wrote in message
...
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 ?






All times are GMT +1. The time now is 09:34 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com