Open source Enterprise Grafana Cloud

CSV

Select CSV as the query type to retrieve data from CSV files or endpoints. You can query data from a URL or provide inline CSV data.

Give it a try using Grafana Play
Give it a try using Grafana Play

With Grafana Play, you can explore and see how it works, learning from practical examples to accelerate your development. This feature can be seen on Infinity plugin CSV demo.

Query a CSV URL

Enter the CSV URL in the query editor. By default, CSV data should have column headers in the first row and use comma delimiters.

Example URL: https://thingspeak.com/channels/38629/feed.csv

Sample data:

csv
created_at,entry_id,field1,field2
2021-02-18 21:46:23 UTC,10458189,6.000000,12.000000
2021-02-18 21:46:39 UTC,10458190,0.000000,36.000000
2021-02-18 21:46:55 UTC,10458191,0.000000,49.000000

Define columns

By default, all columns are returned as strings. To properly format your data, define columns with their types:

PropertyDescription
TitleDisplay name for the column.
SelectorColumn name in the CSV file (case-sensitive).
FormatData type: String, Number, Timestamp, or Boolean.

For time series visualizations, you need at least one time column and one or more numeric columns.

Query data without a time field

For data without timestamps, set the Format to Timeseries to add a simulated time field. This allows visualization in panels like Bar Gauge, Stats, and Gauge.

Example data:

csv
Country,Population
India,3000
China,3500
UK,1200
USA,2000
Germany,700

Use inline CSV data

Instead of querying a URL, you can provide CSV data directly:

  1. Set Source to Inline.
  2. Enter your CSV data in the data field.
  3. Define columns to specify types.

Example inline data:

csv
country,population,capital
india,200,mumbai
china,500,beijing
usa,200,washington
canada,100,ottawa

CSV options

Configure parsing behavior for non-standard CSV files:

OptionDescription
DelimiterCharacter that separates values. Use \t for tab-delimited files.
HeadersComma-separated list of column names if the file has no header row.
Skip empty linesIgnore blank lines in the data.
Skip lines with errorIgnore lines that cannot be parsed.
Relax column countAllow rows with varying numbers of columns.
CommentCharacter that marks the start of a comment (for example, #).

CSV without headers

If your CSV file doesn’t include a header row, specify column names in the Headers option as a comma-separated list.

TSV and custom delimiters

For tab-separated files, either:

  • Set the Delimiter to \t in CSV options, or
  • Select TSV as the query type

Time series field combinations

The Infinity data source automatically handles various field combinations for time series visualization:

Fields presentResult
Time + one metricSingle time series
Time + string + metricMultiple series grouped by string field
Time + multiple metricsMultiple time series
String + number (no time)Categorical data with simulated time

Advanced transformations

For advanced operations like grouping, ordering, and field manipulation, use the UQL parser:

SQL
parse-csv
| order by "field" asc