WRITE_CSV

The WRITE_CSV procedure writes data to a “comma-separated value” (comma-delimited) text file consisting of columns of data.

This routine writes CSV files consisting of one or more optional table header lines, followed by one optional column header line, followed by columnar data, with commas separating each field. Each row is a new record.

This routine is written in the IDL language. Its source code can be found in the file write_csv.pro in the lib subdirectory of the IDL distribution.

Syntax

WRITE_CSV, Filename, Data1 [, Data2,..., Data8] [, HEADER=variable] [, TABLE_HEADER=string array]

Arguments

Filename

A scalar string containing the full pathname of the CSV file to write.

Data1...Data8

The data values to be written out to the CSV file. The data arguments can have the following forms:

Keywords

HEADER

Set this keyword equal to a string array containing the column header names. The number of elements in HEADER must match the number of columns provided in Data1...Data8. If HEADER is not present, then no header row is written.

TABLE_HEADER

Set this keyword equal to an array of strings that will be inserted at the beginning of the CSV file, one string per line. Table header information is inserted before column header information specified by the HEADER keyword (if present).

Version History

7.1

Introduced

8.0

TABLE_HEADER keyword added

See Also

QUERY_ASCII, QUERY_CSV, READ_ASCII, READ_CSV