Solved

Import pipe-delimited text data that contains multi-line fields

Posted on 2014-03-12
2
1,152 Views
Last Modified: 2014-03-28
Hi,

I have a pipe-delimited text file that has multi-line fields.

test.txt
I need to import this file to MS Access or Excel (this was exported out from Oracle).
The desired results are :

results.xlsx
However, there's a line space ('cr lf') after every line, and when I import it to Excel, they get separated to different lines even though they should all be in one cell if they are between pipes.
How can I import this to Excel as 3 column, multi-line?

Thank you.
0
Comment
Question by:iamnamja
2 Comments
 
LVL 35

Assisted Solution

by:PatHartman
PatHartman earned 250 total points
ID: 39924264
You would have to write code.  No standard import can handle such a mess.

I don't see any of identifying where one "record" stops and another record begins unless there is always a blank line between records.  Your code would have to read each record and determine whether it was part of the previous column or should start a new column or a new record.
0
 
LVL 38

Accepted Solution

by:
Jim P. earned 250 total points
ID: 39924905
I have to agree with Pat -- the data is a mess.

Unless there is some kind of indicator of what the start of each individual record is trying to build a good import routine will be very hard.

If there is a consistent number of rows for each one you could possibly pull it into a staging table with just an autonumber and a data column. Then go through and pull row "1" into a variable, then row 2,3, and 4 into another variable, 5,6, and 7 into the next and then write to another table. Rinse and repeat as needed.

You may also consider if you want the column B and C to look like that or break it out to more columns.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question