title: Converting a CSV File Into a 2D Array
body: <p>How can i convert the data inside an CSV file to a 2d array?</p>
  
  <pre><code>array[row][column]
  </code></pre>
  
  <p>I already have an upload script that will display all the data inside a CSV file.</p>
  
  <p>Little snippet of my code, here's the full code: <a href="http://jsfiddle.net/Meesz/wj6q7c30/" rel="noreferrer">http://jsfiddle.net/Meesz/wj6q7c30/</a></p>
  
  <pre><code>reader.onload = function (e) {
    var table = document.createElement("table");
    var rows = e.target.result.split("\n");
    for (var i = 0; i &lt; rows.length; i++) {
      var row = table.insertRow(-1);
      var cells = rows[i].split(",");
      for (var j = 0; j &lt; cells.length; j++) {
          var cell = row.insertCell(-1);
          cell.innerHTML = cells[j];
      }
    }
    var dvCSV = document.getElementById("dvCSV");
    dvCSV.innerHTML = "";
    dvCSV.appendChild(table);
  }
  </code></pre>