Add From Grid Into Excel
Add From Grid Into Excel
com/questions/41841251/appending-data-to-existing-excel-file-using-c-sharp
xlBigSheet = xlWorkBook.Worksheets;
string x = "Sheet1";
xlWorkSheet = (Microsoft.Office.Interop.Excel.Worksheet)xlBigSheet.get_Item(x);
////////////////////////////////////////////////////////////////////////////////////////////////////////////
.
.
xlWorkSheet = (Microsoft.Office.Interop.Excel.Worksheet)xlBigSheet.get_Item("Sheet1");
Microsoft.Office.Interop.Excel.Range last =
xlWorkSheet.Cells.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeLastCell, Type.Missing);
int lastUsedRow = last.Row;
getData(lastUsedRow + 1);
.
.
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
xlWorkBook.SaveAs(newPath, Microsoft.Office.Interop.Excel.XlFileFormat.xlWorkbookNormal,
misValue, misValue, misValue, misValue,
Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlExclusive,
misValue, misValue, misValue,
misValue, misValue);