Hi anybody working on data exporting? I've 4 tables in my sql server database. I want to export these 4 tables data into one excel file in different sheets with column names.
Is it possible?
Thanks in advance
Hi anybody working on data exporting? I've 4 tables in my sql server database. I want to export these 4 tables data into one excel file in different sheets with column names.
Is it possible?
Thanks in advance
You can to create an OpenXML Excel document (XSLX) through Open XML Format SDK 1.0
. Example: Creating spreadsheets from a server application
If you can to drop that multiple worksheets requirement, that would be a lot easier.
yes. You're best off sucking the data in from excel using the copyfromrecordset method
dim conn as new adodb.connection
conn.connectionString = "..."
conn.open
dim sql as string
sql = "..."
sheet1.cells(1,1).copyFromRecordset conn.execute(sql)
There have been lots of previous questions about this. Look here: http://stackoverflow.com/questions/tagged/excel
One component that does what you want is the open-source myXls.
You can use SpreadsheetML, which is just a schema that will let you define a workbook with multiple sheets in xml that Excel will open natively. I have an example here:
http://stackoverflow.com/questions/150339/generating-an-excel-file-in-asp-net/150368#150368
You can export data set to multi sheet excel file in just one line of code. For Details see this link:-