[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?]



Hi !

If commas appear in your data, why are you using it as a delimiter to store
the ascii format?!! Try using a delimiter like | or tab or # that dosen't
appear in your data. :)
If you don't have the original excel file, and if you HAVE to live with this
file, I would use perl to process this file, and replace the delimiter with
something else. I have had such problems, and I have done this as a quick
solution. Run a perl program with this line :

my ($one,$two,$three,$four) = split(',',$fileData,4); 
 to extract the data where $fileData is one record from the file, and then
simply do a 

my $new = "$one|$two|$three|$four\n"; 

and write this in a new file. Now, you can use SQR to read the data and
seperate. Good luck !

HTH,
Vishal Nayak.

owner-sqr-users@list.iex.net wrote:
   Hello All, I have a SQR problem for all you guru's out there. I am
trying to read in an excel flat file (saved as a .CSV) and read that into
SQR variables. The problem is that some of the variables contain commas...
Here's a row from my flat file (.CSV) file

JOB,ACCT_CD,Account Code,"paydes,209","Defines a link between the
distribution of an employee's earnings to funding from a grant, loan, etc."

I want to store this row into these variables into my SQR program

$RecName
$Fieldname
$LongName
$Source
$Descr

The problem is that Excel puts quotes around the columns with a comma in
them. Does anyone know a way to code this so I can
open this file and read these elements into variables? Every row has a
different length of Recname, Fieldname, etc.
Thanks for any info...

-jc


____________________________________________________________________
More than just email--Get your FREE Netscape WebMail account today at http://home.netscape.com/netcenter/mail