We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Populating Worksheet Using Excel Template

Does anyone know how to import an excel template. Then populate the template using data pulled from database?


Thanks for considering Aspose.

May the following sample code help you for your need:

OleDbConnection con = new OleDbConnection("provider=microsoft.jet.oledb.4.0;data source=d:\\test\\Northwind.mdb");
OleDbCommand cmd = new OleDbCommand("Select * from Employees",con);
OleDbDataAdapter da = new OleDbDataAdapter();
da.SelectCommand = cmd;
DataSet ds = new DataSet();

Workbook wb = new Workbook();
//Load the template excel file
//Get the first worksheet.
Worksheet ws = wb.Worksheets[0];
// Import the datatable to it.
ws.Cells.ImportDataTable(ds.Tables["Employees"], true, 0,0,false);
//Save as the excel file
For further reference, please check the following docs:

For Smart markers:
Thank you.

Thanks, that worked out well.