// Write data to cells worksheet.Cells[1, 1] = "Product"; worksheet.Cells[1, 2] = "Sales"; worksheet.Cells[2, 1] = "Laptop"; worksheet.Cells[2, 2] = 1500; worksheet.Cells[3, 1] = "Mouse"; worksheet.Cells[3, 2] = 25;
// Save file string savePath = @"C:\Reports\SalesReport.xlsx"; workbook.SaveAs(savePath, Excel.XlFileFormat.xlOpenXMLWorkbook); microsoft.office.interop.excel version 15.0.0.0
1. Overview Microsoft.Office.Interop.Excel is a primary interop assembly (PIA) provided by Microsoft to allow .NET applications (C#, VB.NET, F#) to communicate with Microsoft Excel through COM (Component Object Model). Version 15.0.0.0 corresponds to Microsoft Office 2013 . // Write data to cells worksheet