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

122
Views
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
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!