Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default Process a text file before import - which language to use?

Somewhat off-track ... I don't know where else to post this.

I need to pre-process a potentially many-row text file before importing it.

The text file has 2 header rows, followed by X-values, a line containing " "
(hex 20) and then Y-values.

I only need the header rows plus X-values. The first header row contains an
integer representing the number of X-values.

Can someone tell me the appropriate programming language to use to strip the
blank line and the lines below it, then save the file with its original
name?

The pseudo code would look something like:

count lines in file = result1
result2 = result1 - 3 (2 header lines plus blank line (contains hex20)
between x and y values)
result3 = result2/2
result4 = result3 + 2
delete rows whose number is result4
save file under original name

I assume I can code VBA to pass the file name I am importing to this new
program and then continue the import when done.

This process will help until the count of X-values exceeds 65,534, at which
time I will have to move the database to ACCESS or SQL Server.

Thanks for any help.

Larry Mehl





---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.600 / Virus Database: 381 - Release Date: 2/28/2004


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default Process a text file before import - which language to use?

Larry -

I just use VBA for this. I open the file from within VBA, read it line
by line, look for whatever patterns I know or suspect exist, and parse
the lines into usable data, which gets dumped into the worksheet.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
http://PeltierTech.com/Excel/Charts/
_______

L Mehl wrote:

Somewhat off-track ... I don't know where else to post this.

I need to pre-process a potentially many-row text file before importing it.

The text file has 2 header rows, followed by X-values, a line containing " "
(hex 20) and then Y-values.

I only need the header rows plus X-values. The first header row contains an
integer representing the number of X-values.

Can someone tell me the appropriate programming language to use to strip the
blank line and the lines below it, then save the file with its original
name?

The pseudo code would look something like:

count lines in file = result1
result2 = result1 - 3 (2 header lines plus blank line (contains hex20)
between x and y values)
result3 = result2/2
result4 = result3 + 2
delete rows whose number is result4
save file under original name

I assume I can code VBA to pass the file name I am importing to this new
program and then continue the import when done.

This process will help until the count of X-values exceeds 65,534, at which
time I will have to move the database to ACCESS or SQL Server.

Thanks for any help.

Larry Mehl





---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.600 / Virus Database: 381 - Release Date: 2/28/2004



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default Process a text file before import - which language to use?

Hi Jon --

Thanks for responding.

I used the line-by-line method successfully, but the president of the
company, whose laptop is newer/faster than mine, says the processing is too
slow.

And, since the customer is always right ....

Larry




"Jon Peltier" wrote in message
...
Larry -

I just use VBA for this. I open the file from within VBA, read it line
by line, look for whatever patterns I know or suspect exist, and parse
the lines into usable data, which gets dumped into the worksheet.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
http://PeltierTech.com/Excel/Charts/
_______

L Mehl wrote:

Somewhat off-track ... I don't know where else to post this.

I need to pre-process a potentially many-row text file before importing

it.

The text file has 2 header rows, followed by X-values, a line containing

" "
(hex 20) and then Y-values.

I only need the header rows plus X-values. The first header row

contains an
integer representing the number of X-values.

Can someone tell me the appropriate programming language to use to strip

the
blank line and the lines below it, then save the file with its original
name?

The pseudo code would look something like:

count lines in file = result1
result2 = result1 - 3 (2 header lines plus blank line (contains hex20)
between x and y values)
result3 = result2/2
result4 = result3 + 2
delete rows whose number is result4
save file under original name

I assume I can code VBA to pass the file name I am importing to this new
program and then continue the import when done.

This process will help until the count of X-values exceeds 65,534, at

which
time I will have to move the database to ACCESS or SQL Server.

Thanks for any help.

Larry Mehl





---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.600 / Virus Database: 381 - Release Date: 2/28/2004





---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.600 / Virus Database: 381 - Release Date: 2/28/2004


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Process a text file before import - which language to use?

You can read it all in or either in chunks into a huge string, then parse it
in memory then write it out.

http://support.microsoft.com/support...eio/fileio.asp
File Access with Visual Basic® for Applications

--
regards,
Tom Ogilvy


"L Mehl" wrote in message
...
Hi Jon --

Thanks for responding.

I used the line-by-line method successfully, but the president of the
company, whose laptop is newer/faster than mine, says the processing is

too
slow.

And, since the customer is always right ....

Larry




"Jon Peltier" wrote in message
...
Larry -

I just use VBA for this. I open the file from within VBA, read it line
by line, look for whatever patterns I know or suspect exist, and parse
the lines into usable data, which gets dumped into the worksheet.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
http://PeltierTech.com/Excel/Charts/
_______

L Mehl wrote:

Somewhat off-track ... I don't know where else to post this.

I need to pre-process a potentially many-row text file before

importing
it.

The text file has 2 header rows, followed by X-values, a line

containing
" "
(hex 20) and then Y-values.

I only need the header rows plus X-values. The first header row

contains an
integer representing the number of X-values.

Can someone tell me the appropriate programming language to use to

strip
the
blank line and the lines below it, then save the file with its

original
name?

The pseudo code would look something like:

count lines in file = result1
result2 = result1 - 3 (2 header lines plus blank line (contains hex20)
between x and y values)
result3 = result2/2
result4 = result3 + 2
delete rows whose number is result4
save file under original name

I assume I can code VBA to pass the file name I am importing to this

new
program and then continue the import when done.

This process will help until the count of X-values exceeds 65,534, at

which
time I will have to move the database to ACCESS or SQL Server.

Thanks for any help.

Larry Mehl





---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.600 / Virus Database: 381 - Release Date: 2/28/2004





---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.600 / Virus Database: 381 - Release Date: 2/28/2004




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I import text file of cash flow to excel file then use formula Bumpa Excel Discussion (Misc queries) 2 May 28th 10 04:22 PM
Import from Acess problems with SQL language toby131 Excel Discussion (Misc queries) 1 November 14th 09 01:38 AM
Would Like to Automate Batch File Creation and Text FIle Import socrtwo Excel Discussion (Misc queries) 2 August 18th 06 03:54 PM
how to write other language in text file from VBA Ravi Excel Programming 1 January 27th 04 03:21 AM
Get External Data, Import Text File, File name problem Scott Riddle Excel Programming 1 July 11th 03 05:40 PM


All times are GMT +1. The time now is 08:32 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"