Solved

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

Posted on 2014-03-12
2
1,129 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 34

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

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

This article explains all about SQL Server Piecemeal Restore with examples in step by step manner.
Shadow IT is coming out of the shadows as more businesses are choosing cloud-based applications. It is now a multi-cloud world for most organizations. Simultaneously, most businesses have yet to consolidate with one cloud provider or define an offic…
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

759 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now