(Requires Analytica Enterprise or Power Player)

WriteCsvFile(filename, A, Field, Row)

Outputs the contents of a 2-D array, «A», to the indicated «filename». «A» is indexed by «Field» and «Row», where «Field» should be a list of labels containing the column names. The file written is in a CSV format (stands for Comma-Separated Values), where the first line contains the column names, and values in each row are separated by commas.

CSV files are readily read in or written out of spread-sheet programs.

Numeric values are formatted according to the current number format. To exercise more control over the actual format, you can convert your array to strings prior to calling.

It is very important that your text values do not contain newline characters or separator (i.e. comma) characters, and the number format for the node where this is used must not have thousand separators enabled (unless you are using something other than comma as your column separator).


Flat File Library.ana

(Use FileAdd Library... to add this library)


A couple of optional parameters can be used to exercise further control over the output.

  • «sep» : column separator. ',' by default. For a tab-delimited file, use WriteCsvFile(filename, A, Field, Row, sep: chr(9))
  • «linesep»: the line separator character.
  • «warn»: Whether to issue a warning when the destination file already exists.

See Also


You are not allowed to post comments.