title: Reading Excel file using SheetJs - Javascript
body: <p>I am trying to read Excel file using SheetJs</p>
  
  <p>But getting following error.</p>
  
  <blockquote>
    <p>Uncaught TypeError: Cannot read property '0' of undefined</p>
  </blockquote>
  
  <p><strong>Here is my file handler function</strong></p>
  
  <pre><code>function handleFileSelect(evt) {
      //Get the files from Upload control
      var files = evt.target.files;
      var i, f;
      //Loop through files
      for (i = 0, f = files[i]; i != files.length; ++i) {
          var reader = new FileReader();
          var name = f.name;
          reader.onload = function (evt) {
              var data = evt.target.result;
  
              var result;
              /* convert from workbook to array of arrays */
              var first_worksheet = data.Sheets[data.SheetNames[0]];
              var data = XLSX.utils.sheet_to_json(first_worksheet, {header:1});
              alert(result[0].Column1);
          };
          reader.readAsArrayBuffer(f);
      }
  }
  </code></pre>