score:1

i am answering my own question. using file system apis does not work on client side javascript as it does not run on node. so first the excel content should be fetched in the form of blob and use that blob. following solution works for me.

import xlsx from "xlsx";
const targetcsvpath = window.location.origin + "/xrayconfig.xlsx";
const reader = new filereader();
reader.onload = function (e) {
  const workbook = xlsx.read(e.target.result, { type: "binary" });
   // your operations on workbook comes here
   }

fetch(targetcsvpath)
 .then((response) => response.blob())
  .then((data) => {
    reader.readasbinarystring(data);
  })
  .catch((err) => console.log(err);

Related Query

More Query from same tag