Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

134
Views
Import Javascript modules in Yeoman Excel add-in project

I'm trying to create an Excel add-in with Yeoman generator. In the excel_project/src/taskpane/taskpane.js file I'd like to call the 'fs' library. When I execute taskpane.js alone on my terminal, everything works fine. However, when I launch the whole Excel project (npm start on my terminal) I have a module import error (see image). It's as if modules couldn't be imported in the Excel add-in... Does anyone have any ideas ? Thanks for your help.

Here is the taskpane.js file, like it is created by Yeoman. I've just added const fs = require('fs'); // this gives the error

Office.onReady((info) => {
  if (info.host === Office.HostType.Excel) {
    document.getElementById("sideload-msg").style.display = "none";
    document.getElementById("app-body").style.display = "flex";
    document.getElementById("run").onclick = run;
  }
});

export async function run() {
  try {

    const fs = require('fs'); // this gives the error

    
    await Excel.run(async (context) => {

      const range = context.workbook.getSelectedRange();
      let text = document.querySelector('textarea').value;

      // Read the range address
      range.load("address");

      // Update the fill color
      range.format.fill.color = "yellow";

      await context.sync();
      console.log(`The range address was ${range.address}.`);
    });
  } catch (error) {
    console.error(error);
  }

}

Here is the error message: enter image description here

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!