<< Click to Display Table of Contents >> Navigation: ThinBASIC Modules > CSV > cCSV class > <cCSV> constructor > <cCSV> methods > <CCSV>.Load |
Description
Parses CSV file with user specified delimiter.
Syntax
nCols = <CCSV>.Load(sFileName [, FirstLineIsHeader [, sCharDelim]])
Returns
Number, number of columns found.
-1 = fail
Parameters
Name |
Type |
Optional |
Meaning |
sFileName |
String |
No |
Full CSV file path name |
FirstLineIsHeader |
Number |
Yes |
If TRUE, first line will be interpreted as line containing column names. Default value is FALSE |
sCharDelim |
String |
Yes |
Single character considered CSV field delimiter.
Default filed delimiter is comma (,)
Default field delimiter can also be set/get by <cCSV>.Char.Delim property. |
Remarks
If all will be fine, Load method will create a <cCSV>.Data(nRow, nCol) matrix
Restrictions
See also
Examples
uses "CSV"
Dim MyCSV As New CCSV
' Default loading, presuming no header and comma as separator
MyCSV.Load(APP_ScriptPath + "Sample-Spreadsheet-10000-rows.csv")
' Presuming comma as separator, but specifying first line is header
MyCSV.Load(APP_ScriptPath + "Sample-Spreadsheet-10000-rows.csv", true)
' Explicitly stating first line is a header and overriding default separator to semicolon
MyCSV.Load(APP_ScriptPath + "Sample-Spreadsheet-10000-rows.csv", true, ";")