Reputation: 192
I have added xlsx.full.min.js file.
here is my code
var workbook = XLSX.read(data, { type: 'binary' });
var sheetName = workbook.SheetNames[0];
var excelData = XLSX.utils.sheet_to_row_object_array(workbook.Sheets[sheetName]);
Upvotes: 2
Views: 7332
Reputation: 38171
For typescript, you have to install @types/xlsx
by npm install @types/xlsx --save
.
Import it this way:
import * as XLSX from 'xlsx';
this is issue on their site.
Upvotes: 7
Reputation: 218
You have to install the XLSX
module using npm install xlsx
then you have to intialize XLSX
variable on top of your code if(typeof require !== 'undefined') XLSX = require('xlsx');
. Check the library details: https://www.npmjs.com/package/xlsx
Upvotes: 3