Page 1 of 1 1
Topic Options
#19265 - 2002-03-29 04:25 AM read csv file
WirelessDJ Offline
Fresh Scripter

Registered: 2002-03-29
Posts: 12
Can anyone provide me with a base kix script to read in a csv file ? i.e.

temp.csv...
field1,field2,field3,field4,field5

all I want to do is open the file and read in all of field3

Top
#19266 - 2002-03-29 04:55 AM Re: read csv file
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Check the manual for the READLINE() example. After reading a line $line, you do a $a=SPLIT($line,',') which will rearrange your CSV line into an array. Then you get the third field as $array[2]
_________________________
There are two types of vessels, submarines and targets.

Top
#19267 - 2002-03-29 08:18 AM Re: read csv file
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
WirelessDJ,

You may also want to look into this: check out the UDF Library for -

READEXCEL - Read an Excel Spreadsheet and return results

Have fun!

- Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#19268 - 2002-03-29 09:44 PM Re: read csv file
New Mexico Mark Offline
Hey THIS is FUN
****

Registered: 2002-01-03
Posts: 223
Loc: Columbia, SC
And in case you didn't have enough good choices, you could also use the Word() and/or GetLine() UDF's. Personally, in your case I lean toward sealeopard's solution as the most direct, but I don't know what else your script is doing. You might be able to get more mileage out of these UDF's.

http://www.scriptlogic.com/Kixtart/FunctionList.asp

New Mexico Mark

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2220 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.064 seconds in which 0.036 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org