CSV to Multi-Dimensional Array. How?

I have been playing around with Line Charts using the Google Charts API and the following example shows a multi-dimensional array being populate into a data table then displayed on the screen.

It works great but I'd like to be able to populate data from a CSV file found in the same folder which may contain n amount of columns.

Can anyone help figure this out?

I think one would access the csv file with JQuery .get and then convert it into an array. I'm just not very JS savvy nowadays..

    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
      google.load("visualization", "1", {packages:["corechart"]});
      function drawChart() {
        var data = google.visualization.arrayToDataTable([
          ['Year', 'Sales', 'Expenses'],
          ['2004',  1000,      400],
          ['2005',  1170,      460],
          ['2006',  660,       1120],
          ['2007',  1030,      540]

        var options = {
          title: 'Company Performance'

        var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
        chart.draw(data, options);
    <div id="chart_div" style="width: 900px; height: 500px;"></div>


You should try the recommendation from Reading client side text file using Javascript It's JS way, from that you can turn each line into an array Other method is by using ajax call to server side and then process the csv and return array I think that will solve the crossbrowser issue problem.

Need Your Help

How to create a scrolling image gallery in iOS?

ios uiimageview uibutton nsarray

In my app, I have 5 images, and 2 buttons(next and previous).

Could not load Spritefont asset as a non-content file

c# monogame spritefont

I'm switching a game from xna to monogame and hit a snag.