xlsx is undefined when trying to export excel sheet

i want to export an excel sheet and using xlsx this is my code :

import XLSX from 'xlsx'; 


const downloadExcel = () => {
    const worksheet = XLSX.utils.json_to_sheet(excelExport);
    const workbook = XLSX.utils.book_new();
    XLSX.utils.book_append_sheet(workbook, worksheet, 'kelvin');
    let buf = XLSX.write(workbook, { booktype: 'xlsx', type: 'buffer' });
    //binary string
    XLSX.write(workbook, { booktype: 'xlsx', type: 'binary' });
    XLSX.writeFile(workbook, 'kelvin.xlsx');

but when i try to use this function i get an error that says : Kelvin.js:64 Uncaught TypeError: Cannot read properties of undefined (reading 'utils') and the xlsx is undefined i don't know what did i wrong

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum