Excel file to database

How do I import an Excel file (resultat.xls) to a sql 2008 database? Is there a excempel available?



resultat_a54f5db4.xls

3 Replies

GM Geetha M Syncfusion Team July 29, 2009 11:18 AM UTC

Hi Kjell,

It is not directly possible to export an XLS file to a SQL database. You can convert the file into a DataTable / DataView and then manually export it.

You can refer to the sample in the location given below that explains exporting of XLS file to a DataTable.
My Documents\Syncfusion\EssentialStudio\x.x.x.xx\Windows\XlsIO.Windows\Samples\2.0\Data Binding\Import-Export DataTable\

Please let me know if you have any questions.

Regards,
Geetha


SB Shannon Broskie February 5, 2015 09:25 PM UTC

Can't the workbook be saved as a memory stream and then converted to a byte array for saving to the DB?


SR Sudha Ramachandran Syncfusion Team February 11, 2015 09:10 AM UTC

Hi Shannon,

 

Yes, the workbook be saved as a memory stream as represented in the below code snippet. This memory stream can then be converted to a byte array for saving to the DB.

 

Code Snippet:

 

//Create new memory stream

MemoryStream stream = new MemoryStream();

//Save the excel workbook as stream

workbook.SaveAs(stream, ExcelSaveType.SaveAsXLS);

 

UG Documentation Link: http://help.syncfusion.com/ug/asp.net/default.htm#!documents/saveworkbookasastrea.htm

 

Please let us know if you have any queries.

Regards,

Sudha R


Loader.
Up arrow icon