04 CopyCsv2 - AndrewMB2/Logic-Architect-for-Excel-VBA GitHub Wiki

CopyCsv2 method

Copies data from a csv file. Returns True if successful, otherwise False.

Applies to

TableData ArrData RsetData Xdata XShared

Parameters

Name Type Description
FileName Variant File name and path from which the data will be copied. Also accepts an array of records.
WithHeaders Boolean True indicates that the csv file has headers.
WithQuotes Boolean True indicates that the csv file may include double-quote characters on text fields.
SepChar String Separator character.
Terminator Variant Terminator (if any).
Fields Value, array or ParamArray Fields to be copied.

CopyCsv2 copies data from a csv file to the end of this ArrData object (also accepts an array of records in FileName).

WithHeaders determines whether a header is present on the csv file.

WithQuotes determines whether to look for text quotes in csv data (double-quote characters are normally placed round data which contains the separator character). If True, the method will remove the double-quote characters and not treat these separator characters as separators. In this case double-quote characters inside the data are normally doubled up so it converts "" to " .

Fields is the list of fields to be copied. If no list of fields is supplied then all fields are copied which are present on both the csv file and the calling ArrData object. If Fields is * then all fields from the csv file are copied and must be present on the calling ArrData object. If Fields is specified, the method skips records at the start of the file till a header matching the specified fields is found.

Processing stops if Terminator is encountered. Terminator can be an array of possible values. If no terminator is needed, Terminator should be set to Empty.

The method removes any UTF8 byte order mark at start of the file.