Importing a DataTable to a sheet
Output: ImportDataTable.xlsx
public void Run()
{
var workbook = new Workbook();
var worksheet = workbook.Worksheets[0];
DataTable table = new DataTable();
table.Columns.Add("IntColumn", typeof(int));
table.Columns.Add("DoubleColumn", typeof(double));
table.Columns.Add("StringColumn", typeof(string));
table.Columns.Add("DateColumn", typeof(DateTime));
table.Rows.Add(1, 2.3, "ABC", new DateTime(2010, 2, 3));
table.Rows.Add(2, 3.4, "BCD", new DateTime(2010, 3, 4));
table.Rows.Add(3, 4.5, "CDE", new DateTime(2010, 4, 5));
table.Rows.Add(4, 5.6, "DEF", new DateTime(2010, 5, 6));
table.Rows.Add(5, 6.7, "EFG", new DateTime(2010, 6, 7));
DataImportExport.Import(worksheet["B2"], table);
workbook.SaveAs("ImportDataTable.xlsx");
}