Search code examples
node.jsexcelxlsxexceljs

When I open the excel file its missing values in cells that weren't edited


I open a xlsx file that contains names and description of automation test. Then I place the value of 'pass' or 'fail' into the respective cell for a test. Then I write back to the xlsx file. When I open the file to look at the results I notice several cells with test names missing. There is no error message as far as the program go it believes everything is working fine. here is the code i use for editing the excel file. Does anyone know why its doing this?

function writeToExcel(value)
{
  var Excel = require('exceljs');
  var workbook = new Excel.Workbook();
  workbook.xlsx.readFile('reports/Mobile Test.xlsx').then(function()
  {
      var worksheet = workbook.getWorksheet('TestCases');
      worksheet.getCell("E27").value = value;
      workbook.xlsx.writeFile('reports/Mobile Test.xlsx');
  });
}


Solution

  • Well after looking at what the cells that where messing had in common I noticed all the cells that were missing have words inside (parentheses) the cells without parentheses were still there so somethings happening when trying to write parentheses, but I don't need the parentheses so I just took them out and it worked fine.