title: Add Cell and Row in openXML
body: <p>I have pre define excel format i need to pass the data to excel.I'm able to get the particular sheet .But don't know how to pass the data to cell.</p>
  
  <pre><code>var excelDocument = new ExcelDocument();
  var fileName = Guid.NewGuid();
  string filePath = HttpContext.Current.Server.MapPath("~/Uploads/TemplateFiles/test.xlsx");
  
  using (SpreadsheetDocument document =
         SpreadsheetDocument.Open(filePath, false))
  {
         WorkbookPart workbookPart = document.WorkbookPart;
         Workbook workbook = document.WorkbookPart.Workbook;
         string sheetName = workbookPart.Workbook.Descendants&lt;Sheet&gt;().ElementAt(1).Name;
         IEnumerable&lt;Sheet&gt; sheets = document.WorkbookPart.Workbook.Descendants&lt;Sheet&gt;().Where(s =&gt; s.Name == "Census Template for Import");
         if (sheets.Count() == 0)
         {
                // The specified worksheet does not exist.
                return null;
         }
         WorksheetPart worksheetPart = (WorksheetPart)document.WorkbookPart.GetPartById(sheets.First().Id);
         SheetData sheetData = worksheetPart.Worksheet.GetFirstChild&lt;SheetData&gt;();
         var excelRows = sheetData.Descendants&lt;DocumentFormat.OpenXml.Spreadsheet.Row&gt;().ToList();
         int rowindex = 10;
         foreach (var item in census)
         {
                //how to write the data in cell
                rowindex++;
         }
  
         worksheetPart.Worksheet.Save();
         workbookPart.Workbook.Save();
         document.Close();
         //worksheetPart.Worksheet.Save();
   }
   return filePath;
  </code></pre>