Load data from CSV files

To load CSV data we recommend Papa Parse, a popular open source CSV parser that plays very nicely with DataGridXL.

Load remote CSV file (using AJAX)

Javascript
Papa.parse("http://example.com/file.csv", {
  download: true,
  complete: function(results) {
    createGrid(results);
  }
});

function createGrid(data){
  
  var grid = new DataGridXL("grid", {
    data: data
  });

};

The Papa.parse method loads the given URL using AJAX. Wait for its complete callback to fire, then create your data grid with the freshly parsed data.

Load CSV file from user's computer

You can also pass in a local File from an <input type="file"> element. We actually have a demo for this.

Javascript
Papa.parse(fileInput.files[0], {
  complete: function(results) {
    createGrid(results);
  }
});

function createGrid(data){ ... };

Leave email to receive latest updates!