csv.from() function

The csv.from() function retrieves data from a comma-separated value (CSV) data source. It returns a stream of tables. Each unique series is contained within its own table. Each record in the table represents a single point in the series.

import "csv"

    csv: csvData,
    mode: "annotations",

// OR

    file: "/path/to/data-file.csv",
    mode: "annotations",



CSV data. Supports annotated CSV or raw CSV. Use mode to specify the parsing mode.

Annotated CSV data must include all annotation rows.


The file path of the CSV file to query. The path can be absolute or relative. If relative, it is relative to the working directory of the fluxd process. The CSV file must exist in the same file system running the fluxd process.

InfluxDB OSS and InfluxDB Cloud user interfaces do not support the file parameter. Neither allow access to the underlying filesystem. However, the Flux REPL does support the file parameter.


CSV parsing mode. Default is annotations.

Available modes
  • annotations: Use CSV annotations to determine column data types.
  • raw: Parse all columns as strings and use the first row as the header row and all subsequent rows as data.


Query annotated CSV data from a file
import "csv"

csv.from(file: "/path/to/data-file.csv")
Query raw CSV data from a file
import "csv"

csv.from(file: "/path/to/data-file.csv", mode: "raw")
Query an annotated CSV string
import "csv"

csvData =

csv.from(csv: csvData)
Query a raw CSV string
import "csv"

csvData =

csv.from(csv: csvData, mode: "raw")

Function updates

Was this page helpful?

Thank you for your feedback!

Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.