Populating Worksheet Using Excel Template

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

Hi,

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");
con.Open();
OleDbCommand cmd = new OleDbCommand("Select * from Employees",con);
OleDbDataAdapter da = new OleDbDataAdapter();
da.SelectCommand = cmd;
DataSet ds = new DataSet();
da.Fill(ds,"Employees");

Workbook wb = new Workbook();
//Load the template excel file
wb.Open("d:\\test\\bktemp.xls");
//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
wb.Save("d:\\test\\filledbook.xls");
For further reference, please check the following docs:
For Smart markers:
Thank you.

Thanks, that worked out well.