TS2339: Property 'getOoxml' does not exist on type 'Worksheet'

15 Views Asked by At

using node v20.12.0 "react": "^18.2.0"

I have create react application using yo man generator for office version 5.0.0.

file code is like:

async function getExcelOOXML() {
    try {
        await Excel.run(async (context) => {
            const sheet = context.workbook.worksheets.getActiveWorksheet();
            const ooxml = sheet.getOoxml();
            await context.sync();

            console.log('OOXML content:', ooxml.value);
            // Handle the OOXML data as needed
        });
    } catch (error) {
        console.error('Error retrieving OOXML:', error);
    }
}


export default getExcelOOXML;

getting following error:

  TS2339: Property 'getOoxml' does not exist on type 'Worksheet'.

please provide the suitable fix. I have tried installing dev dependency but issue still persists:

 npm install @types/office-js --save-dev

please provide the possible solution that can fix the issue or guide in solving.

0

There are 0 best solutions below