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

410
Vistas
Missing Macros and vba after modifying excel xlsm using Javascript library Sheetjs

I am using Sheetjs to edit an existing file of excel with extension xlsm macro enabled. It works but after downloading output file, all the styling, macro and vba script gets deleted. here is the code which I am using

<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.18.2/xlsx.full.min.js" integrity="sha512-oCjkwxjURabnte5K4Zeoc+hZ/G5pQE7GI4DYl+0wl6WaJIkBjb9FvUIaMU3lOPoBMSRZZ7QrczpGQoBFAKKB1Q==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script>
    (async () => {
        const url = "{{ URL('/') }}/test.xlsm"
        const data = await (await fetch(url)).arrayBuffer();
        /* data is an ArrayBuffer */
        //   const workbook = XLSX.read(data);
        try {
            const workbook = XLSX.read(data, {
                bookVBA: true,
                type:'binary'
            });

            let worksheet = workbook.Sheets['Raw Data'];
            var desired_cell = worksheet['B8'];
            var desired_value = (desired_cell ? desired_cell.v : undefined);
          
            XLSX.utils.sheet_add_aoa(worksheet, [
                ['NEW VALUE from NODE']
            ], {
                origin: 'B8'
            });
            XLSX.utils.sheet_add_aoa(worksheet, [
                ['NEW VALUE from NODE']
            ], {
                origin: 'B9'
            });
            XLSX.writeFile(workbook, './out.xlsm', {
                bookVBA: true,
                type:'binary'
                
            });
            console.log('Completed ...');

        } catch (error) {
            console.log(error.message);
            console.log(error.stack);
        }

    })();
</script>
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