Dear All ,
I want to create an array from .CSV file. any Function / Class for this ?
Please provide some sample code. Thanks in advance...!
Thanks
Shridhar
H,ABC CO.,08052019, INV00031
D,10210,CROCIN TAB , 10, 30.00, 300, 10.00,10.00,320.00
D,21205,AMLOX TAB , 10, 20.00, 300, 10.00,10.00,220.00
D,21535,CFLOX TAB , 10, 10.00, 300, 10.00,10.00,120.00
F,30,30,660.00
aData := { { 10210,CROCIN TAB , 10, 30.00, 300, 10.00,10.00,320.00 }, ;
{ 21205,AMLOX TAB , 10, 20.00, 300, 10.00,10.00,220.00 }, ;
{ 21535,CFLOX TAB , 10, 10.00, 300, 10.00,10.00,120.00 } }
aData := HB_ATokens( cCsv, CRLF )
AEval( aData, { |c,i| aData[ i ] := HB_ATokens( c, "," ) } )
local cCSVFile := "purcbill.csv"
local cCsv
oFile := TTxtFile():New( cCSVFile )
oFile:GoTop()
Do while !oFile:Eof()
cCsv := cCsv + oFile:ReadLine()
oFile:Skip()
Enddo
aData := HB_ATokens( cCsv, CRLF )
AEval( aData, { |c,i| aData[ i ] := HB_ATokens( c, "," ) } )
local cCSVFile := "purcbill.csv"
local cCsv
oFile := TTxtFile():New( cCSVFile )
oFile:GoTop()
Do while !oFile:Eof()
cCsv := cCsv + oFile:ReadLine()
oFile:Skip()
Enddo
cCsv := MEMOREAD( cCsvFile )
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 73 guests