csvRead

Reads a CSV file and returns it in the requested format, such as a query, an array of structs or arrays, or a CSV string.

csvRead(filePath, outputFormat [, rowFilter] [, csvFormatConfiguration]) → returns any

This function requires Adobe ColdFusion 2025 and up.  Not supported on Lucee, etc.

Argument Reference

filePath string
Required

Path of the CSV file to read.

outputFormat string
Required

Format of the returned data.
Values:
  • csvstring
  • arrayofcfarray
  • arrayofjavaarray
  • arrayofstruct
  • query
  • xlsx
  • csvrecorditerable

rowFilter function

Function that receives the row array and row number, and returns true to include the row.

csvFormatConfiguration struct

Struct of parsing options. Keys include delimiter, quoteCharacter, escapeCharacter, encoding, header, skipHeaderRecord, ignoreEmptyLines, ignoreHeaderCase, allowMissingColumnNames, duplicateHeaderMode, commentMarker, nullString, trim and trailingDelimiter.

Examples
Sample code invoking the csvRead function

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub