This project has moved and is read-only. For the latest updates, please go here.

How to add few worksheets to one workbook?

Mar 18, 2016 at 1:39 PM
Edited Mar 18, 2016 at 1:40 PM
Hello, I created a function, what exports DataTable to excel document, but i don't understand how to add more than one worksheet to this document?
Excel.Application application = new Excel.Application();
application.DisplayAlerts = false;
Excel.Workbook workBook = application.Workbooks.Add();
Excel.Worksheet workSheet = (Excel.Worksheet)workBook.Worksheets[1];
// ....   filling workSheet  .... 
application.ActiveWorkbook.SaveAs(myDialog.FileName);
application.Quit();
application.Dispose();