View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
nutrition nutrition is offline
external usenet poster
 
Posts: 5
Default Importing ASCII text into worksheet

I need a program that will read information from an ASCII file, which data is
organized in fixed width. The width of the first column is 8 characters long
and the columns that follow are in width of 16 characters long.

For rows that start with GRID*, the 2nd column needs to be imported into a
worksheet in Excel in column A. For the same row, the data in the 4th column
needs to be imported into the same worksheet into column B and the data in
5th column needs to be imported into the same worksheet in column C.

For rows that start with *, the 2nd column needs to be imported into the
same row above in column D.


The following is some sample data:


$
$ --------------- begin exec section ---------------------------
$
CEND
$
$
$ ---------------- end exec section ---------------------------
$ --------------- begin case control ---------------------------
$
TITLE =
ECHO = NONE
OUTPUT
METHOD = 10
SPC = 1
$
$
$ ---------------- end case control ---------------------------
$ --------------- begin bulk data ---------------------------
$
BEGIN BULK
PARAM,
PARAM,
E
GRID* 11948 02.547415380E+0035.913292032E+002+
* 1.392468901E+003 0 0
GRID* 11949 02.568299386E+0035.823013553E+002+
* 1.404233550E+003 0 0
GRID* 11950 02.560183765E+0036.110349623E+002+
* 1.393538123E+003 0 0
GRID* 11951 02.585286928E+0036.047367958E+002+
* 1.406622591E+003 0 0
GRID* 11952 02.604819484E+0034.976212049E+002+
* 1.437870452E+003 0 0
GRID* 11953 02.587617792E+0035.171256767E+002+
* 1.426662596E+003 0 0
GRID* 11954 02.579635566E+0034.921914698E+002+
* 1.427609606E+003 0 0
GRID* 11955 02.608029258E+0035.197200252E+002+
* 1.435260482E+003 0 0
GRID* 11956 02.509450618E+0031.571528462E+002+
* 1.430737695E+003 0 0
GRID* 11957 02.511725472E+0031.316694151E+002+
* 1.432848509E+003 0 0

The results should be like this:

Column A Column B Column C Column D
11948 2.547415380E+003 5.913292032E+002 1.392468901E+003
11949 2.568299386E+003 5.823013553E+002 1.393538123E+003
etc...


Can anyone help?