views:

222

answers:

3

Hello,

I am looking for any tips or resources on importing from excel into a SQL database, but specifically when the information is NOT in column and row format.

I am currently doing some pre-development work for a project, and in most ways I would like to use SSIS for the project. The one area that my research and googling is leaving a big question mark over is the import of the excel sheet.

In short our users are using excel as a simple calculator / application. Values are entered into specific cells in the sheet and then in other cells formulas come up with the final answers. The sheet has been "beautified" to make it easier for users to use (i.e. white space, merged cells, pretty colours, etc). I need a mechanism to get both the raw values and the final answers and import them into a SQL database.

There is a ton of information on the trials and tribulations of importing column and row info into Excel, but have any fellow stack-overflowers had experience with this? Is SSIS appropriate for this (the other viable option would have to be integration into a .NET service).

Thanks!

+2  A: 

What about adding a sheet to the workbook that pulls the answers from the calculation sheet and shows them in a tabular format, and then use the magic of SSIS to suck in the values from that new sheet?

If you can't modify the worksheet, you might want to look into Interop services or something where you can specify the exact cells you want to pull data from.

I'd try the first route if possible, though another option might be to simply recreate their Excel calculator as a .NET app...

Cory Larson
I was wondering about that, but I will not know the number of sheets I need to aggregate (depends from case to case). We also do not have time in the project to rewrite the sheet :(Thanks for the thoughts tho
Chris
How about writing a macro within the Excel workbook to aggregate the data to a hidden sheet, then using SSIS to suck it out of that sheet? The macro could be smart enough to look at all visible sheets or something like that if the number of them is unknown.
Cory Larson
Actually that could work - I could look to trigger the macro on closure of the sheet to ensure the hidden sheet was up to date. Thanks!
Chris
A: 

A SSIS Excel data source uses worksheet or range -- think table with column names. You could also consider using VBA from within Excel to push data into your DB.

Damir Sudarevic
When you say VBA within excel, is that something I could automate from an SSIS package? The excel documents will exist on a SharePoint repository, and for various reasons cannot be uploaded at the time the user stores the doc (unless I created a temporary storage place in the DB for them)
Chris
I was thinking of pushing data to DB via VBA while user is calculating. However, you can run almost anything from SSIS using "Execute Process Task".
Damir Sudarevic
A: 

SpreadsheetGear for .NET will let you load an Excel workbook, put values in cells, calculate, get results as raw values or formatted text and more. This might be your best option if the data is not suitable for SSIS - but it will require that you use .NET (C#, VB or any .NET language) to automate your process. The advantage of SpreadsheetGear is that you then have a solution which does not depend on anything other than .NET (of course it depends on SpreadsheetGear, but SpreadsheetGear can be deployed royalty free with your application using xcopy deployment or any other deployment method).

You can see live samples here and download the free trial here.

Disclaimer: I own SpreadsheetGear LLC

Joe Erickson