PC SOFT

PROFESSIONAL NEWSGROUPS
WINDEVWEBDEV and WINDEV Mobile

Home → WINDEV 25 → Wx - Importar arquivo CSV - Procedure WS_ImportCSV
Wx - Importar arquivo CSV - Procedure WS_ImportCSV
Started by adrianoboller, Aug., 28 2015 8:36 PM - No answer
Registered member
3,659 messages
Popularité : +175 (223 votes)
Posted on August, 28 2015 - 8:36 PM
Procedure WS_ImportCSV(sFullFileName is string)

sCsvSeparator is string = ";"
sCsvRow is string
nFileNum is int
nLoop, Total is int
nCol is int
nJumCol is int = 1

// Create a Table Control with the sufficient (more) column
//TableDeleteAll(TABLE_Table1)

nFileNum = fOpen(sFullFileName,foRead)
IF nFileNum = -1 THEN
Error("File not found!")
ELSE
LOOP
sCsvRow=fReadLine(nFileNum)
nCol=1
Total = Length(sCsvRow)
FOR nLoop = 1 TO Total
IF sCsvRow[[nLoop]] = sCsvSeparator THEN
sCsvRow[[nLoop]] = TAB
nCol ++
END
END
Info(sCsvRow)
//TableAdd(TABLE_Table1,sCsvRow)
IF sCsvRow = EOT THEN BREAK
END
fClose(nFileNum)
END