title: Angular get headers from excel uploaded using XLSX
body: <p>I want to get the first row(name,email,mobile) as array from an uploaded excel file.</p>
  
  <blockquote>
    <p>I am using XLSX.</p>
  </blockquote>
  
  <p>I am getting whole data into array. But, I want only to read top line. because, </p>
  
  <blockquote>
    <p>my excel file is quite large.</p>
  </blockquote>
  
  <p><a href="https://i.stack.imgur.com/iZCl5.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iZCl5.jpg" alt="enter image description here"></a></p>
  
  <pre class="lang-js prettyprint-override"><code>onFileChange(event) { //when user uploads xls file
      const fileList: FileList = event.target.files;
      if (fileList.length &gt; 0) {
        const file: File = fileList[0];
        const reader = new FileReader();
        reader.onload = function (e) {
          const arrayBuffer = this.result,
            data = new Uint8Array(arrayBuffer),
            arr = new Array();
          for (let i = 0; i !== data.length; ++i) {
            arr[i] = String.fromCharCode(data[i]);
          }    
          const bstr = arr.join('');
  
          const workbook: XLSX.WorkBook = XLSX.read(bstr, { type: 'binary' });
          const firstSheetName: string = workbook.SheetNames[0];
          const worksheet: XLSX.WorkSheet = workbook.Sheets[firstSheetName];
          // getting all rows
          console.log(XLSX.utils.sheet_to_json(worksheet, { header: 1 })); 
          // I want to get top row only.
          console.log(XLSX.utils.decode_row('A1')); 
  
        };
        reader.readAsArrayBuffer(file);
      }
    }
  </code></pre>