Loading CSV File


Ability to load CSV files is one of the things Data Adapter provides.

To work with the features Data Adapter provides you need to plug it in along with AnyChart Library:

<!-- Include the data adapter -->
<script src="https://cdn.anychart.com/releases/8.12.1/js/anychart-data-adapter.min.js"></script>

You can load Data from CSV into AnyChart without the help of Data Adapter but if you want to load a file you can do it using the data adapter and the loadCsvFile() method as described below.

loadCsvFile() method

Using loadCsvFile() method is as easy as this:

anychart.data.loadCsvFile("https://cdn.anychart.com/charts-data/data_csv.csv", function (data) {
	// create chart from loaded data
	chart = anychart.bar(data);
	// set title
	chart.title("AnyChart from CSV File");
	// draw chart

Here is a live sample:


This method also allows to handle loading errors, changing sending method, adding headers, setting timeout interval, and sending credentials, see all available parameters in loadCsvFile() API description.

CSV Settings

To learn about availale CSV Data settings please refer to the Data from CSV article.