Documentation

csv.from() function

csv.from() retrieves data from a comma separated value (CSV) data source and returns a stream of tables.

Function type signature
(?csv: string, ?file: string, ?mode: string) => stream[A] where A: Record

For more information, see Function type signatures.

Parameters

csv

CSV data.

Supports anonotated CSV or raw CSV. Use mode to specify the parsing mode.

file

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.

mode

is the CSV parsing mode. Default is annotations.

Available annotation modes

  • annotations: Use CSV notations 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.

Examples

Query annotated CSV data from file

import "csv"  csv.from(file: "path/to/data-file.csv")

Query raw data from CSV file

import "csv"  csv.from(file: "/path/to/data-file.csv", mode: "raw")

Query an annotated CSV string

import "csv"  csvData =  " #datatype,string,long,dateTime:RFC3339,dateTime:RFC3339,dateTime:RFC3339,string,string,double #group,false,false,false,false,false,true,true,false #default,,,,,,,, ,result,table,_start,_stop,_time,region,host,_value ,mean,0,2018-05-08T20:50:00Z,2018-05-08T20:51:00Z,2018-05-08T20:50:00Z,east,A,15.43 ,mean,0,2018-05-08T20:50:00Z,2018-05-08T20:51:00Z,2018-05-08T20:51:00Z,east,A,65.15 ,mean,1,2018-05-08T20:50:00Z,2018-05-08T20:51:00Z,2018-05-08T20:50:20Z,east,B,59.25 ,mean,1,2018-05-08T20:50:00Z,2018-05-08T20:51:00Z,2018-05-08T20:51:20Z,east,B,18.67 ,mean,2,2018-05-08T20:50:00Z,2018-05-08T20:51:00Z,2018-05-08T20:50:40Z,east,C,52.62 ,mean,2,2018-05-08T20:50:00Z,2018-05-08T20:51:00Z,2018-05-08T20:51:40Z,east,C,82.16 "  csv.from(csv: csvData)

View example output

Query a raw CSV string

import "csv"  csvData =  " _start,_stop,_time,region,host,_value 2018-05-08T20:50:00Z,2018-05-08T20:51:00Z,2018-05-08T20:50:00Z,east,A,15.43 2018-05-08T20:50:00Z,2018-05-08T20:51:00Z,2018-05-08T20:50:20Z,east,B,59.25 2018-05-08T20:50:00Z,2018-05-08T20:51:00Z,2018-05-08T20:50:40Z,east,C,52.62 "  csv.from(csv: csvData, mode: "raw")

View example output


Was this page helpful?

Thank you for your feedback!


New in InfluxDB 3.5

Key enhancements in InfluxDB 3.5 and the InfluxDB 3 Explorer 1.3.

See the Blog Post

InfluxDB 3.5 is now available for both Core and Enterprise, introducing custom plugin repository support, enhanced operational visibility with queryable CLI parameters and manual node management, stronger security controls, and general performance improvements.

InfluxDB 3 Explorer 1.3 brings powerful new capabilities including Dashboards (beta) for saving and organizing your favorite queries, and cache querying for instant access to Last Value and Distinct Value caches—making Explorer a more comprehensive workspace for time series monitoring and analysis.

For more information, check out:

InfluxDB Docker latest tag changing to InfluxDB 3 Core

On November 3, 2025, the latest tag for InfluxDB Docker images will point to InfluxDB 3 Core. To avoid unexpected upgrades, use specific version tags in your Docker deployments.

If using Docker to install and run InfluxDB, the latest tag will point to InfluxDB 3 Core. To avoid unexpected upgrades, use specific version tags in your Docker deployments. For example, if using Docker to run InfluxDB v2, replace the latest version tag with a specific version tag in your Docker pull command–for example:

docker pull influxdb:2