Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

124
Visualizações
Edit .docx and xslx files from Express and React

I have a web application, which uses excel and word files to generate documentation, these files are stored on a local server, which is found on all network computers as a shared folder, at the time of deployment the application locally everything works correctly, but when I deploy it to a server in the cloud it stops working, the server tells me that it cannot find the excel and word files, according to me, it is because it is looking for the files in the same server in the cloud and not in the shared folder where they are stored.

Do you have any idea how I can fix this?

I share the code

Controller:

req.body.BD is equals to "K:/Compartida/INGRESOS/pr.xlsx"

const xlsx = require('xlsx');
const ExcelJS = require('exceljs');
const controlador = {};

controlador.Add = async (req, res) => {
//Here I receive the information of the front and save it in the excel file
    const wb = new ExcelJS.Workbook();
    wb.xlsx.readFile(req.body.BD)
        .then(() => {
            const ws = wb.getWorksheet(req.body.SheetName);
            ws.addRow(req.body.datos);
            wb.xlsx.writeFile(req.body.BD).then(() => {
                res.status(200).json({ Message: "Guardado exitoso" });
            });
        }).
        catch((error) => {
            res.status(500).json({ Message: "Ocurrio un error", error });
        });
};

controlador.Edit = async (req, res) => {

    const wb = new ExcelJS.Workbook();
    wb.xlsx.readFile(req.body.BD)
        .then(() => {
            const ws = wb.getWorksheet(req.body.SheetName);
            ws.eachRow((data) => {
                for (let j = 0; j < req.body.datos.length; j++) {
                    if (data.getCell(1).value === req.body.datos[j][0]) {
                        for (let i = 2; i <= data.cellCount; i++) {
                            data.getCell(i).value = req.body.datos[j][i - 1];
                        };
                    };
                };
            });

            wb.xlsx.writeFile(req.body.BD);
            res.status(200).json({ Message: "Guardado exitoso" });
        }).catch((error) => {
            res.status(500).json({ Message: "Ocurrio un error", error });
        });
};

controlador.GetAll = async (req, res) => {
    try {
        const wb = xlsx.readFile(req.body.BD, { cellDates: true, sheetRows: false });
        const ws = wb.Sheets[req.body.SheetName];
        const data = xlsx.utils.sheet_to_json(ws);

        res.status(200).json({ data });
    } catch (error) {
        res.status(500).json({ Message: "Ocurrio un error", error });
    };
};

module.exports = controlador;


about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda