I have a scenario where I need to store all data of current workbook including template to a new excel workbook/ worksheet and store that new file to database in BLOB. I am using C#. Any demo available ?
Asked
Active
Viewed 484 times
0
-
1Why both SQL Server and DB2, out of curiosity – gbn Jun 14 '11 at 19:38
2 Answers
0
Consider using the Open XML SDK to read and write Excel documents. It can read and write Office 2007 and 2010 compatible documents without the need for Excel to be installed on the machine/server. Another approach would be to automate Excel (instantiate an Excel.Application object, and then programmatically drive Excel to do the work).
I usually recommend option 1.

Fammy
- 513
- 3
- 14
-
I want to do it programmatically using C# with application object. Any tutorial to store whole excel file to db as it is without reading its content ? – Cannon Jun 14 '11 at 20:18
-
Not that I am aware of. If it is saved on disk, you can read its contents with File.ReadAllBytes and then store those bytes in the DB. – Fammy Jun 14 '11 at 20:59
-
Lets say there is scenario where you have to store all data of your current sheet to db in such way that when u fetch the data back and put it on new worksheet the template remains preserved. Any way to implement this ? – Cannon Jun 14 '11 at 21:23
0
Have a look at that question.
The accepted answer recommends using an open source library called NPOI for manipulating spreadsheets.