Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

131
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda