currently I am working on a project where I need to put a certain value to a certain field in a excel file I am doing that by using exceljs but after putting the value the result amount should be according to the given calculations which is not happening I am updating the code please have a look and help me
const express = require('express')
const router = express.Router()
const Excel = require('exceljs')
const writeFile = async (salary) => {
const filename = 'public/Guatemala_2022_Tax_File.xlsx'
const output = 'public/output.xlsx'
const workbook = new Excel.Workbook()
await workbook.xlsx.readFile(filename)
var worksheet = workbook.getWorksheet("Sheet1")
const row = worksheet.getRow(2)
row.getCell('B').value = salary
await workbook.xlsx.writeFile(output);
}
router.post('/excel', async(req,res) => {
await writeFile(req.salary)
const newWorkbook = new Excel.Workbook();
await newWorkbook.xlsx.readFile('public/output.xlsx');
const newworksheet = await newWorkbook.getWorksheet('Sheet1');
console.log('k2 value',newworksheet.getCell('K2').value)
res.json(newworksheet.getCell('K2').value)
})
module.exports = router
this is the code
thanks in advance