Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 18th, 2003, 01:11 PM
go_tech's Avatar
go_tech go_tech is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: Irvine, CA
Posts: 15 go_tech User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question convert txt file into excel or access

I have a problem to convert the txt file with header and spaces into MS excel or access. I have a dump data text file that contains fields and records. Each field has certain amount of characters. At the beginning of the file there are 20 lines of the main header. After the main header, the next 5 lines are the sub header. Main header is not redundant, but the sub headers are redundant inconsistently(meaning it can stop after different number of records). There is no pipe between the fields. At the end of every record there is a 'cls'. I am not familiar with data conversion. I am running in a big problem here! Please help me out if you have been dealing with file conversion. Is there any available code or module that I can use to modify adapting my needs?

GT

Reply With Quote
  #2  
Old December 18th, 2003, 01:22 PM
Fisherman's Avatar
Fisherman Fisherman is offline
Inherits Programmer.Slacker
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Aug 2003
Location: Between my Id and your Ego
Posts: 2,178 Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 9 h 56 m 45 sec
Reputation Power: 111
Send a message via ICQ to Fisherman Send a message via AIM to Fisherman
well, there are several ways to pull data from txt to xls or mdb, but all of the ones I know of are contingent on one of two things - either a delimiter, such as a comma or space or special character, or known length records. Without one of those two conditions, I wouldn't know how to begin to tell you how to parse it.
__________________
Fisherman

"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." - A.Einstein

Reply With Quote
  #3  
Old December 18th, 2003, 04:16 PM
go_tech's Avatar
go_tech go_tech is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: Irvine, CA
Posts: 15 go_tech User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
OK, there is a blank line at and the word 'cls' at the beginning and the end of the record. There are certain amount of characters reserve for each field. All field are separated by tab.

Please look up the attachement for an example.

Thanks,

GT
Attached Files
File Type: txt test.txt (1.0 KB, 475 views)

Reply With Quote
  #4  
Old December 18th, 2003, 06:25 PM
Fisherman's Avatar
Fisherman Fisherman is offline
Inherits Programmer.Slacker
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Aug 2003
Location: Between my Id and your Ego
Posts: 2,178 Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 9 h 56 m 45 sec
Reputation Power: 111
Send a message via ICQ to Fisherman Send a message via AIM to Fisherman
ok, is this the output or the input. Is this an existing format that some company has that you can't change, or can you change the way this done? Usually tab delimited files only have one tab between files

Reply With Quote
  #5  
Old December 18th, 2003, 10:27 PM
cleverpig cleverpig is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2003
Posts: 1,152 cleverpig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via MSN to cleverpig
U can read each line in this file,and analyse this line to get some information,input this information into a variable in vb..When u have read a line of this file in a variable,u can put this variable into excel or access...
Read file plz visit www.msdn.com and find file system object to get some knowledge..

Reply With Quote
  #6  
Old December 18th, 2003, 11:10 PM
Fisherman's Avatar
Fisherman Fisherman is offline
Inherits Programmer.Slacker
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Aug 2003
Location: Between my Id and your Ego
Posts: 2,178 Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 9 h 56 m 45 sec
Reputation Power: 111
Send a message via ICQ to Fisherman Send a message via AIM to Fisherman
cp- the file system object is really necessary for file input from a text file. If you have any kind of delimiter, then you can use the split function on a temporary variable to produce an array.

Reply With Quote
  #7  
Old December 19th, 2003, 09:37 AM
go_tech's Avatar
go_tech go_tech is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: Irvine, CA
Posts: 15 go_tech User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
First of all, I appreciated for all of the responses. The attachment was the input. I just want to give you some examples and ideas about how my text file looks like. The out put could be either .xls or .mdb. The reason I change the name of the data because this is a confidential info. As long as I have some program to convert the current input, I can tweek the program to adapt my needs.

GT

Reply With Quote
  #8  
Old December 19th, 2003, 05:14 PM
Fisherman's Avatar
Fisherman Fisherman is offline
Inherits Programmer.Slacker
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Aug 2003
Location: Between my Id and your Ego
Posts: 2,178 Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 9 h 56 m 45 sec
Reputation Power: 111
Send a message via ICQ to Fisherman Send a message via AIM to Fisherman
well... you can read this file into an array of strings one line at a time, where one array object represents one line of text. The only problem with this is separating the text out. This file doesn't lend itself to flat-file databases very well, since the formatting isn't consistent. I'm guessing that this is predefined and you can't change it?

Reply With Quote
  #9  
Old December 20th, 2003, 10:24 AM
cleverpig cleverpig is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2003
Posts: 1,152 cleverpig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via MSN to cleverpig
2 way is same...Fisherman & i can help u!If u meet some trouble in read file!...:->

Reply With Quote
  #10  
Old December 23rd, 2003, 12:01 PM
go_tech's Avatar
go_tech go_tech is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: Irvine, CA
Posts: 15 go_tech User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thank you both of you for the offer. Anyway, if you open the file in wordpad you will see its layout. It doesn't have consistent data, but it has consistent reserved characters. Please help me out to read the data. I am not familiar with data conversion programming. Thanks

GT

Reply With Quote
  #11  
Old December 23rd, 2003, 11:54 PM
cleverpig cleverpig is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2003
Posts: 1,152 cleverpig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via MSN to cleverpig
Yes,I know!..I have read your post file.It's have a Field name in the top of the file.U can read each line from this file except the field name line,and analyse this line to get some field value according the field name line content..

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > convert txt file into excel or access


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT