Skip to content

Instantly share code, notes, and snippets.

@guntidheerajkumar
Created August 4, 2016 10:00
Show Gist options
  • Save guntidheerajkumar/536952690a701598543c4e2aba325dc7 to your computer and use it in GitHub Desktop.
Save guntidheerajkumar/536952690a701598543c4e2aba325dc7 to your computer and use it in GitHub Desktop.
Type excelType = Type.GetTypeFromProgID("Excel.Application", true);
dynamic excel = Activator.CreateInstance(excelType);
excel.Visible = true;
excel.Workbooks.Add();
dynamic worksheet = excel.ActiveSheet;
worksheet.Cells[1, "A"] = "This is first Column";
worksheet.Columns[1].AutoFit();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment