Horje
read xlsx file in angular 5 Code Example
read xlsx file in angular 5
//import it

    import * as XLSX from 'ts-xlsx';

//inside export class

arrayBuffer:any;
file:File;
incomingfile(event) 
  {
  this.file= event.target.files[0]; 
  }

 Upload() {
      let fileReader = new FileReader();
        fileReader.onload = (e) => {
            this.arrayBuffer = fileReader.result;
            var data = new Uint8Array(this.arrayBuffer);
            var arr = new Array();
            for(var i = 0; i != data.length; ++i) arr[i] = String.fromCharCode(data[i]);
            var bstr = arr.join("");
            var workbook = XLSX.read(bstr, {type:"binary"});
            var first_sheet_name = workbook.SheetNames[0];
            var worksheet = workbook.Sheets[first_sheet_name];
            console.log(XLSX.utils.sheet_to_json(worksheet,{raw:true}));
        }
        fileReader.readAsArrayBuffer(this.file);
}




Javascript

Related
javascript get current date format dd mm yyyy hh mm ss Code Example javascript get current date format dd mm yyyy hh mm ss Code Example
npm ERR! code ELIFECYCLE npm ERR! errno 2 npm ERR! functions@ lint: `tslint --project tsconfig.json` Code Example npm ERR! code ELIFECYCLE npm ERR! errno 2 npm ERR! functions@ lint: `tslint --project tsconfig.json` Code Example
isotope cdn Code Example isotope cdn Code Example
javascript canvas beziercurveto Code Example javascript canvas beziercurveto Code Example
puppeteer how to serch for text Code Example puppeteer how to serch for text Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
6