title: Inserting a cell in an existing Sheet in NPOI
body: <p>Can somebody please help me out. I need to insert a cell in an existing sheet. I'm using NPOI library for processing Excel data.
  Thanks.</p>
  
  <p>This is what I want to achieve. I have loaded an excel in a Sheet object. My target is to insert few columns in the existing sheet and save it to another excel file. I tried to create a cell on the index where i intended the cell is getting created by it is overwriting the previous cell at that position. I need a functinoality wherin I can insert a cell in between two cells.
  Below is the code.</p>
  
  <pre><code> using (FileStream fs = new FileStream(Path, FileMode.Open, FileAccess.ReadWrite))
   {
              wb = new HSSFWorkbook(fs);
              NPOI.SS.UserModel.ISheet sheet = wb.GetSheetAt(0);
              NPOI.SS.UserModel.IRow headerRow = sheet.GetRow(1);
              int columnCount = headerRow.Cells.Count;
              int rowCount = sheet.LastRowNum;
              string ColumnContractStartDate = string.Empty;
  
              //adding header cells at index 7 and 8
              HSSFCell cell7 = (HSSFCell) headerRow.CreateCell(7);
              cell7.SetCellValue("* Contract Start Date");
  
              HSSFCell cell8 = (HSSFCell) headerRow.CreateCell(8);
              cell8.SetCellValue("* Contract End Date");
  
                //adding row cells at index 7 and 8
                  for (int j = 2; j &lt; rowCount; j++)
                  {
                      NPOI.SS.UserModel.IRow dataRow = sheet.GetRow(j);
                      //PFS ROws
                      dataRow.CreateCell(7).SetCellValue("");
                      dataRow.CreateCell(8).SetCellValue("");
                   }
  
                  FileStream file = new FileStream("F:\\ShareDataFeed\\test12.xls", FileMode.Create);
               wb.Write(file);
               file.Close();
               fs.Close();
     }
  </code></pre>