2

If Im using SqlBulkCopy in .net 4.0 on a sql 2008 R2 database to upload excel data to the database, do I actually need Excel on the box hosting the site for this to work?

The reason I ask is I have a site up and running with this, and the hosting box has excel. The customer wants the site moved to a new box, this one doesnt have Excel and that bulk copy doesnt work. Other than the lack of excel there is no other difference.

thanks

DarkW1nter
  • 2,933
  • 11
  • 67
  • 120
  • What excel data are you loading to the database? The whole file, or specific data, like sheet one, column one? – Jethro Aug 23 '11 at 14:34
  • Its the first sheet (probably be the only sheet) in the workbook, matching column headings with fieldnames in a table – DarkW1nter Aug 23 '11 at 14:38
  • Is this a regular thing you need to do, or a one off. If a one off - any reason why you cannot do this on your setup, backup and restore the database to the new box? – iandotkelly Aug 23 '11 at 14:45
  • Then as far as I know you will need to have Excel installed. I know I always have to get it installed on the clients server before I install my web App. I'm not sure if you used Office 2010 sdk, I heard you can use Xml files or something to read and write data. Prehard you should look at that. – Jethro Aug 23 '11 at 14:45

1 Answers1

1

If you are using the Microsoft Excel Object Library (COM Interop) to interface with Excel from .Net 4, then yes you need Excel installed as that is interfacing with the Excel object library.

What are your project references in C#?

Anything link to office automatiion would need taht part of office that is being automated. Also, if .Net 4 that objects may be referenced with the dynamic keyword.

Hard to tell exactly without knowing the project, references, and relevant code.

However, there are several third party libraries that allow interaction with Excel without having Excel installed. So, if you need to work without Excel, investigate using those.

Jon Raynor
  • 3,804
  • 6
  • 29
  • 43
  • And here's the [Excel library Stack Overflow question](http://stackoverflow.com/questions/151005/create-excel-xls-and-xlsx-file-from-c). – Rup Aug 24 '11 at 08:39