[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Re: SQR Issue - Can I read a Excel Flat File into SQR Variables?
- Subject: Re: SQR Issue - Can I read a Excel Flat File into SQR Variables?
- From: Hugh Vishner <Vishner@AOL.COM>
- Date: Fri, 8 Jan 1999 21:57:13 EST
John,
Like others, I have written routines to deal with .CSV files (for input and
output). There are times that .CSV format is dictated by the source or target
of the file.
However, when I have a choice, I save my EXCEL files as TAB-DELIMITED (.TXT)
files. It reduces problems with parsing, etc., since you almost never
encounter a column with an embedded TAB (ASCII 9). After OPENing the file as
VARY, and reading each record into a generic $rec_variable, I simply UNSTRING
into $field_variable1 $field_variable2, etc. using the TAB as a delimiter.
QUOTES are a still an issue, of course, for columns containing a QUOTE.
I do the same thing for output files. All my standard files are written as
WRITE #myfile from
$field1 $delim
$field2 $delim
$field3 $delim
If I desire a plain flat file, I
LET $delim = '' ! null
and the fields are contiguous.
If I desire a tab-delimited file, I
LET $delim = chr(9) ! tab (ascii)
If I associate .TXT (or an extension of your choice) with EXCEL, simply
clicking on the file in EXPLORER opens EXCEL and pops the fields into the
columns automatically.
Hope this is of some value
Hugh Vishner
Vishner Information Services
(201) 803-3247