Thursday, 9 April 2009

Excel: CSV schema file

When reading data programmatically from a CSV file via ASP, datatypes for each columns are determined by an initial scan of the first few rows of the file.
This does not give an accurate representation of the data type of each column.
You can define a schema.ini file and position this file in the same folder as the csv.
The schema file is loaded when required and contains custom attributes used when reading the csv file.

e.g.

SCHEMA.INI

[YOURCSVFILE.csv]
ColNameHeader=False
MaxScanRows=0
Format=CSVDelimited

No comments: