bumbaermail
23rd September 2008, 11:47
Hello,

I have to read a .csv file with structure as following:

Cust#, Name, Segment
627500,ABC Company,315590
70147,Another Company,319985
404405,Third Company, 254897
..............
................

I am using seq.open, seq.eof, seq.get, string.scan, seq.close to read the file. My question is how to skip the First Line/Heading Line?

Thanks in advance
Bumba

zardoz
23rd September 2008, 11:51
Just discard the first record... do 2 consecutive seq.get first.

BaanInOhio
25th September 2008, 19:55
Determine a column in your .csv that must contain a number.

Locate that field before parsing (unless you are using string.scan to string variables then converting afterward) and check the result of a lval() or val() statement. A failure identifies a record that you don't want to read.

When importing comma delimited text that may contain descriptions of fields that contain commas, you probably want a function to scan the record for ," to remove the double quotes and commas between the quotes.