Hi @Al Harlow , Welcome to Microsoft Q&A,
Maybe you want to see a use case of creating excel using c#:
using System;
using Excel = Microsoft.Office.Interop.Excel;
namespace ExcelCreationExample
{
class Program
{
static void Main(string[] args)
{
//Create Excel application object
Excel.Application excelApp = new Excel.Application();
//Create a new workbook
Excel.Workbook workbook = excelApp.Workbooks.Add();
// Get the first worksheet
Excel.Worksheet worksheet = workbook.Worksheets[1];
//Write sample data in cell A1
worksheet.Cells[1, 1] = "Hello";
worksheet.Cells[1, 2] = "World";
//Save workbook
workbook.SaveAs("example.xlsx");
// Close the workbook
workbook.Close();
// Close the Excel application
excelApp.Quit();
// Release the COM object
ReleaseObject(worksheet);
ReleaseObject(workbook);
ReleaseObject(excelApp);
}
// Release the COM object
static void ReleaseObject(object obj)
{
try
{
System.Runtime.InteropServices.Marshal.ReleaseComObject(obj);
obj = null;
}
catch (Exception ex)
{
obj = null;
Console.WriteLine("Exception Occured while releasing object " + ex.ToString());
}
finally
{
GC.Collect();
}
}
}
}
Best Regards,
Jiale
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.