Search code examples
electronexceljs

Doing workbook.xlsx.writeFile without page reload (refresh or restart) in Electron


const Exceljs = require('exceljs');
let wb = new Exceljs.Workbook();
wb.xlsx.readFile(sourceFileName).then(function(){ 
                        let SheetName = "Sheet1";
                            var sh;
                            sh = wb.getWorksheet(SheetName); 
                            var cell = sh.getCell('C6');
                            cell.value = 242;   
                            wb.xlsx.writeFile(fileName).then(function(){
                                console.log("Success");
                            });

                        });

This is my code.

The problem is "when I write the new excel file, then It forces my electron application to reload"

I simply wanted to open the existing excel file and edit.

My questions are ..

  1. Is it possible to edit existing excel file without using wb.wlsx.writeFile and writing again?

  2. If I can't, then how can I prevent reload of electron application??


Solution

  • It was because I saved the excel file in my app folder.

    After I changed fileName's path outside app folder, there was no reload.

    May this be helpful for some developers who are in the same level with me.

    referecne : https://github.com/Unitech/pm2/issues/2710#event-959600970