Repository navigation
dos_readdelimitedfile
Reads a delimited text file from disk. A delimited file is a specially formatted text file which stores spreadsheet or database-style information in a very simple format, with one row/record on each line, and each column/ field within that row/record separated by a delimiter character.
Each row that is read from the file is split into a specified number of columns based on the specified delimiter character. The columnar data is then converted to the appropriate data type, either numbers or strings, and added to a list that will eventually be returned. Empty or missing columns will be represented as empty elements (nil) in the list.
A list containing one or more lists will be returned. The number of elements in each list will correspond to the maximum number of columns found in the file.
ANSI, UTF-8 and Unicode encoded text files are supported.
(dos_readdelimitedfile [filename [delimiter [ignore_empty [trim_spaces]]])
filename
The name of an existing delimited text file to read.
delimiter
The file's delimiter character. If omitted, a comma character will be used.
ignore_empty
If omitted or nil, then if an empty row in the file is encountered, a nil element for each column will be added to the list. If T, then empty lines will be ignored.
trim_spaces
If omitted or nil, then leading and trailing spaces for string elements in the will not be trimmed. If T, then leading and trailing spaces will be trimmed.
A list containing one or more lists if successful.
nil on error.
Command: (dos_readdelimitedfile "users.csv")
(("Ted" 1 2.3 3) ("Bill" 2 5 6.7) ("Larry" 7.1 8 9))