Export Highcharts data to CSV

How Highcharts CSV export works, what the file contains and leaves out, and when it is the right way to share chart data in spreadsheets and other tools.

Highcharts can turn the data behind a chart into comma-separated values (CSV), a plain-text table that spreadsheets, databases and scripts can read. This review explains what the export produces, what it changes compared with the chart on screen, and where it may fall short. No product-specific measurements or test results were available for this article. Statements about Highcharts behavior reflect its documented options, which can change between versions. Check them against the version you use.

Is CSV export suitable for your use?

CSV export works well when people need the numbers behind a chart rather than the picture. Typical cases are analysis in a spreadsheet, archiving the values a chart showed, or giving readers an accessible, text-based alternative to a graphic. The main benefit is portability. The file is plain text, so almost any data tool can open it and the values stay editable.

The main tradeoff is that CSV keeps the values and drops the visual meaning. Colors, annotations, highlighted ranges, trend emphasis and the chart's visual story do not survive. If readers need the interpretation, a short written summary or the chart itself is more useful. Plain prose or a simple on-page table can be the better choice when the audience only needs a few key figures, or when the data is too small to be worth a download.

Situation | CSV export fits? | Why
Reader wants to recalculate or filter the values | Yes | Values arrive as editable cells
You need a text alternative to a chart for accessibility | Often, alongside an on-page table | A downloaded file is less direct than an HTML table on the page
Reader needs to understand a trend at a glance | No | CSV carries no visual emphasis or commentary
Only two or three figures matter | Usually not | A sentence states them more clearly than a file
Data will be imported into another system automatically | Yes, if delimiter and date format are configured | Machine-readable structure, but settings must match the importer

What the export actually changes

CSV export is a data conversion, not a visual effect. The export-data module, which works with the exporting module, reads the series data the chart has loaded. It writes that data out as rows of text. The categories or x-values typically become the first column, each series becomes a column, and each data point becomes a row. The documented API includes methods to get the CSV as a string or trigger a download, plus menu items to download CSV or view a data table.

Several things are transformed along the way. Numbers become text written with a configurable decimal separator. Dates on datetime axes become formatted strings according to a date format option, not raw timestamps. Column headers come from series names unless you supply a custom header formatter. These stored character changes are what the recipient gets.

Separate these stored changes from presentation settings. Options such as reversing an axis, swapping axes or styling labels change how the chart looks. They do not necessarily change the order or content of the exported rows. Do not expect the CSV to mirror what appears on screen. Compare one export against the chart before relying on it.

There are also gaps the documentation does not settle for every case. These include how processed data, such as grouped or aggregated points in stock charts, appears in the export, and how series hidden by the user are treated. A per-series option exists to include or exclude a series from data export. For anything beyond that, verify with your own chart configuration.

Commonly used CSV options

  • itemDelimiter: the character between values, usually a comma or semicolon
  • lineDelimiter: the character sequence between rows
  • decimalPoint: the decimal separator written into numbers
  • dateFormat: how datetime values are written as text
  • columnHeaderFormatter: a function to control header text
  • includeInDataExport (series option): whether a series appears in the export
Highcharts.chart('container', {
  exporting: {
    csv: {
      itemDelimiter: ';',
      decimalPoint: ','
    }
  },
  series: [{
    name: 'Sales',
    data: [12.5, 14.1, 9.8]
  }]
});

// Get the CSV as a string instead of downloading it
const csvText = chart.getCSV();

The example assumes the exporting and export-data modules are loaded. It uses a semicolon delimiter and a comma decimal point. That pairing is common where the comma serves as the decimal separator, because it stops the comma from being read as a column break.

Will the file stay readable and usable after sharing?

Because CSV is plain text, copying and pasting it keeps its content intact. How it displays, however, depends on the program that opens it. A few issues come up repeatedly.

  • Delimiter and locale mismatch: a spreadsheet set to a semicolon-separated locale may put an entire comma-separated row into one cell, and the reverse is also possible. Match the delimiter to where the file is going.
  • Character encoding: names with accents or non-Latin scripts can display incorrectly if the opening program guesses the wrong encoding. Test with the specific application your readers use. One correct rendering does not prove all will work.
  • Dates: formatted date strings may be reinterpreted or reformatted by the spreadsheet on import. Choose an unambiguous date format if the file feeds another system.
  • Formula interpretation: some spreadsheet programs treat cells beginning with characters such as an equals sign, plus, minus or at sign as formulas. If series names or labels come from user input, review whether they need sanitizing before export. This article does not confirm whether Highcharts handles this for you.

On accessibility, a CSV file gives screen reader users access to the values once it is opened in a spreadsheet or text editor. Still, it is a separate download, not part of the page's reading order. The data table view provided by the same module places an HTML table on the page, which is usually a more direct text equivalent. Behavior with particular assistive technologies was not tested for this article. If accessibility is a requirement, test the table and the downloaded file with the tools your audience relies on.

For search and editing, the exported file itself is not indexed as part of your page. If the figures should be findable or quotable, state them in the page text or an on-page table as well. Editing is straightforward in any spreadsheet. Edits made to the CSV do not flow back into the chart.

Bottom line

Highcharts CSV export is a sound way to hand over chart data for analysis or reuse, as long as you configure the delimiter, decimal point and date format for the destination. Pair it with a written summary or on-page table when readers need the meaning, not just the numbers. Treat details such as processed data, hidden series, encoding and formula handling as things to verify in your own setup.