Delimited text files
This following .adoinfo file uses the Microsoft OLE DB Provider for ODBC to read from delimited text files:
<ADODSC>
<ConnectionString>
Provider=MSDASQL;
Driver={Microsoft Text Driver (*.txt; *.csv)};
DBQ=D:\temp\csv;
Extensions=asc,csv,tab,txt;
Persist Security Info=False;
</ConnectionString>
<Table>
QueryResult.csv
</Table>
</ADODSC>
DBQ specifies the folder location for the .csv file. The .csv file name is specified as inner text for theTable element.
Delimiter formats
Although the comma character is the most widely-used delimiter the ODBC Text Driver supports the following delimiter formats, which can be set in the Schema.ini file.
Note The Schema.ini file must be in the same location as the .csv file.
Tab delimited
File fields are separated by tabs.
Schema.ini syntax
Format = TabDelimited
CSV delimited
File fields are separated by commas. Note that there should not be a space between the comma and the start of the next field name or value. For example:
LastName,FirstName
Schema.ini syntax
Format = CSVDelimited
Custom delimited
File fields are separated by some character other than a tab or a comma. You cannot use the double-quote character as a delimiter. The following example uses the asterisk character as the delimiter:
LastName*FirstName Jones*Steve
Schema.ini syntax
Format = Delimited(x) where x represents the character used as the delimiter. For example, when using the asterisk (*) as the delimiter, the Format statement would be:
Format = Delimited(*)
Fixed-length
File fields take up a specific number of characters. If a value is too long, the extra characters are removed. If a value is too short, blank spaces are appended in order to fill the requisite number of characters.
Schema.ini syntax
Format = FixedLength
Example Schema.ini file
The contents of the Schema.ini file could resemble the following:
[File_1.txt]
Format=CSVDelimited
[File_2.txt]
Format=TabDelimited
[File_3.txt]
Format=Delimited(;)
See also
See also