Parse raw data

  • Thread starter Thread starter Larry
  • Start date Start date
L

Larry

I would like to take a string of data and parse it into a
excel spreadsheet. I could have a string data with a
record length of 70 for one spreadsheet and another with a
length of 7000 for a different spreadsheet. The string
data is not delimited. Your assistance would be greatly
appreciated.
 
So what are the rules for breaking up the data into columns, or do you want
it all in column 1.

Generally, either the data is fixed width or delimited. If it is neither,
then I am not sure how you would be able to determine where one field ends
and another begins.

Excel has 256 columns - a 7000 width record - would that be broken into less
than 256 columns?
 
The record is fixed length. I want to parse out the data
into sevral rows in one column. The rows will have
description of what that value is used for. The external
7000 byte record will only have one record in it at a
time. I have already created all the sheadsheets of the
different record lengths and there discriptions.
 
read the file in as a single string, then use the mid function to select the
pieces you want

assume you 7000 byte record is in the variable sLine

Open "C:\Myfolder\Myfile.txt" for Input as #1
Line Input #1, sLine
Close #1
cells(3, 2) = Mid(sline,300,40)
cells(4, 2) = Mid(sLine,341,3)
would give you the 40 characters beginning at position 300 in B3 and the 3
characters starting at postion 341 in B4 for example.
 
Back
Top