Sheet.js XLSX to be used in client side in meteor


I am trying to use XLSX npm package but not able to use on client side of meteor application as an error is occurring , i cant use Npm.require on client side …

Uncaught ReferenceError: XLSX is not defined

what to do ???


Which package? If you import it on the client, it should be available there… No guarantee that it works in a browser if it was designed to run only in node, but nothing stops it from being bundled and sent. Can we see relevant code?


i am using sheet.js to read an excel file on client side

this is my code snippet

var reader = new FileReader();
                reader.onload = function (e) {
                    var data =;
                    if (!rABS) data = new Uint8Array(data);
                    var workbook =, { type: rABS ? 'binary' : 'array' });
                    var first_sheet_name = workbook.SheetNames[0];
                    console.log("sheet name ", first_sheet_name);

                    /* DO SOMETHING WITH workbook HERE */
                 if (rABS) reader.readAsBinaryString(file); else reader.readAsArrayBuffer(file);


i am not able to import it on client side i have added node module file on client side in folder


Snippet isn’t fully helpful… Are you actually importing XLSX?

import XLSX from 'xlsx';


I use it successfully…

import XLSX from 'xlsx';

		const f = acceptedFiles[0];
		const reader = new FileReader();
		const rABS = true; // true: readAsBinaryString ; false: readAsArrayBuffer
		reader.onload = e => {
			let data =;
			if (!rABS) data = new Uint8Array(data);
			const workbook =, { type: rABS ? 'binary' : 'array' });
			// This will format the first sheet of the file into an array of string values.
			const frmt = XLSX.utils.sheet_to_json(workbook.Sheets.Sheet1, { header: 1 });
				if (rABS) {
		} else {

Bah - forgive the poor formatting when stripping to the nuts and bolts of this…


yes i used this line ‘import XLSX from ‘xlsx’;’ but this syntax was not working in my js file , i am using common js script


This doesn’t make sense in the context of a Meteor app.