If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Other > splitting up a csv file

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-14-04, 13:25
4thstar 4thstar is offline
Registered User
 
Join Date: Feb 2004
Posts: 2
splitting up a csv file

Hello All.

i am a little stuck , my understanding of excel access and others is a little limited ..

I have a csv file and access to more.
these files contain products/descriptions/urls/prices etc

if i have a file that contains 10 products with 9 fields in each
i want to load into excell and have 10 rows of 9 columns

but i only get 1 row with 90 columns ?

i use the correct delimiter of | that seperates the fields but it seems theres no carrage return on the end of every 9th field to indicate the next row

I have attached an example so hope someone can direct me in the right direction.

Kind Regards
Carl

maybe a step by step help would be best for me
Attached Files
File Type: zip example.zip (5.9 KB, 29 views)
Reply With Quote
  #2 (permalink)  
Old 02-16-04, 12:03
corneliusd corneliusd is offline
Registered User
 
Join Date: Feb 2004
Location: Beaverton, Oregon, USA
Posts: 11
Re: splitting up a csv file

It looks like there's no programmatical way to determine the end of a record--except for a certain number of fields. From my testing, Excel will consider fixed-length fields, but not fixed-number-of-field records.

I'm guessing you'll need to write a script that knows about the number of fields and puts in the CR/LF every 9th field. I don't know VBScript well enough to do it, but am sure it can be done. Otherwise, take whatever your favorite programming tool is and do it externally, to modify the file before importing it.
__________________
David Cornelius
http://CorneliusConcepts.com
Reply With Quote
  #3 (permalink)  
Old 02-16-04, 17:53
4thstar 4thstar is offline
Registered User
 
Join Date: Feb 2004
Posts: 2
Thanks for input :) all sorted :)

Thanks.

I tried Vb and i had it working just fine other than the fact i could only load a file variable large enough to hold about 100 records ..

I found another way

I loaded the text file into WORD
set to the start of the document and set a macro to :

find the next | and repeat 9 times
add a CR
then do again until the end of file is reached
save as a text file

when loaded into excel BINGO !!! all sorted

Kind Regards
Carl@4thstar.net

Hope this helps others with the same pain in the Ar$£ problem
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On