title: How to remove or delete data from an existing excel file using exceljs?
body: <p>I have an excel file on my system stored at a specific location and I am using exceljs library to read and write data into it. When my code runs, data is being written in the excel file as an output. When the same code runs again, I want to delete or completely remove the previous data on the same worksheet before writing new data.
  How can I do it?</p>
  
  <p>I have tried below line of code to remove the data but when I use the 'RowCount' function then it gives me the previous count.</p>
  
  <p>for example:
  First my code wrote 10 rows of data.
  then I replaced those 10 rows data with the below line of code to clear the data.
  But after this when I do the RowCount, I got the same count of data that was removed. It means that empty string is also stored as data in the excel.</p>
  
  <pre><code>var Excel = require('exceljs');
  var wrkbook = new Excel.Workbook();
  wrkbook.xlsx.readFile(filepath).then(function () {
  var worksheet2 = wrkbook.getWorksheet(sheet);
  let r=worksheet2.rowCount;
  console.log("r value is: "+r);
  for (var i=1;i&lt;=r;i++){
  worksheet2.getRow(i).getCell(1).value = "";
  worksheet2.getRow(i).commit();
  wrkbook.xlsx.writeFile(filepath);
  </code></pre>