CSV Parser

The CSVParser script is a script for reading CSV files and parsing them into Director lists. It can also be used to write lists of lists back out to CSV files. Here is a small demo movie that will read CSV files and display them as tables in Director. The script uses the PregEx Xtra to read and write files, as well as processing text with RegExp.

Note that this script treats any CR, LF or CRLF as record separators. This means that this script doesn't allow for embedded line breaks (which the CSV format allows for). Fields are quoted if they contains double-quotes, commas or leading/trailing white space. White space is preserved if quoted - but note that Excel will try to be 'helpful' (in a very Microsoft way) and trim whitespace even if it is quoted.

If your fields may include linebreaks, then MediaMacros has another CSV parsing script that will handle embedded line breaks.

First published 08/08/2005