Difference between revisions of "WriteCsvFile"

 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[Category:Database Functions]]
+
[[Category: Database Functions]]
 +
[[Category: Flat File library functions]]
 
[[Category: Obsolete and deprecated functions]]
 
[[Category: Obsolete and deprecated functions]]
  
Line 16: Line 17:
  
 
== Library ==
 
== Library ==
Flat File <code>Library.ana</code>
+
[[media:Flat File Library.ana|Flat File Library.ana]]
  
(Add this using '''File &rarr; Add Library...''' before using)
+
(Use [[File menu|File]] &rarr; '''Add Library...''' to add this library)
  
 
== Notes==
 
== Notes==
Line 27: Line 28:
  
 
== See Also ==
 
== See Also ==
 +
* [[media:Flat File Library.ana|Flat File Library.ana]]
 
* [[ReadCsvFile]]
 
* [[ReadCsvFile]]
 
* [[WriteTextFile]]
 
* [[WriteTextFile]]
 +
* [[ParseCsvText]]
 +
* [[Files and editing]]

Latest revision as of 20:22, 24 May 2016


(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).

Library

Flat File Library.ana

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

Notes

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

Comments


You are not allowed to post comments.