title: Reading excel file into array using javascript
body: <p>I'm trying to read an excel file and create a multidimensional array in javascript with it.
  The excel file will look like:</p>
  
  <pre><code>AA11 AA22 AN65
  AB11 AB22 AN64
  ...
  </code></pre>
  
  <p>I need it to create an array that looks like:</p>
  
  <pre><code>[
      [AA11, AA22, AN65],
      [AB11, AB22, AN64]
  ]
  </code></pre>
  
  <p>So far, I've been able to bring up a file selection window, and I believe it's reading the file, I just think it might not be putting the data into the array correctly. This is what I have so far:</p>
  
  <pre><code>    &lt;script type="text/javascript"&gt;
          $(function () {
              $("#input").on("change", function () {
              var excelFile,
              var array = [[],[]];
                  fileReader = new FileReader();
  
              $("#result").hide();
  
              fileReader.onload = function (e) {
                  var buffer = new Uint8Array(fileReader.result);
  
                  $.ig.excel.Workbook.load(buffer, function (workbook) {
                      var column, row, newRow, cellValue, columnIndex, i,
                          worksheet = workbook.worksheets(0),
                          columnsNumber = 0,
                          gridColumns = [],
                          data = [],
                          worksheetRowsCount;
                      while (worksheet.rows(0).getCellValue(columnsNumber)) {
                          columnsNumber++;
                      }
                      for (columnIndex = 0; columnIndex &lt; columnsNumber; columnIndex++) {
                          column = worksheet.rows(0).getCellText(columnIndex);
                          gridColumns.push({ headerText: column, key: column });
                      }
                      for (i = 1, worksheetRowsCount = worksheet.rows().count() ; i &lt; worksheetRowsCount; i++) {
                          newRow = {};
                          row = worksheet.rows(i);
  
                          for (columnIndex = 0; columnIndex &lt; columnsNumber; columnIndex++) {
                              cellValue = row.getCellText(columnIndex);
                              //newRow[gridColumns[columnIndex].key] = cellValue;
                              array[row,columnIndex] = cellValue;
                          }
  
                          window.alert(array[0][0]);
                          data.push(array);
                      }
  
      &lt;/script&gt;
  </code></pre>
  
  <p>Any help would be greatly appreciated.</p>