Solved

Adding a namespace that doesn't exist for a SSIS Script Transformation

Posted on 2016-11-08
3
30 Views
Last Modified: 2016-11-08
I need to add the Microsoft.Office.Interop.Excel namespace reference so I can apply an Excel macro in a SSIS Script Transformation Component.  When I edit the Script Transformation and go to add a Reference, Microsoft.Office.Interop.Excel does not exist.  I've made sure that .NET Programmability Support was selected when I installed Microsoft Office and I've also installed the Visual Studio 2010 Tools for Office Runtime.

The code I need to add looks like this but it don't build without the namespace reference.  Thanks!!
Excel.Application xlApp = new Excel.Application();
Excel.Workbook xlWorkBook = xlApp.Workbooks.Open("C:\\ExcelDirectory\\DATA.xlsm"); // absolute path needed
xlApp.Run("Formatting"); // method overloads allow you to send it parameters, etc.
xlWorkBook.Close(true); // first parameter is SaveChanges
xlApp.Quit();

Open in new window

0
Comment
Question by:Basssque
  • 2
3 Comments
 
LVL 14

Accepted Solution

by:
Megan Brooks earned 500 total points
ID: 41879189
It's actually the assembly reference that you need to add, before your code will be able to use the namespace. I haven't had to do this myself, but here's an article from 2011 that describes steps (that I have not tested).

SSIS Script Task and Microsoft Office Automation
1
 

Author Closing Comment

by:Basssque
ID: 41879242
That was helpful.  I installed the Primary Interop Assemblies Redistributable and it showed up under COM/Type Libraries opposed to Assemblies
0
 
LVL 14

Expert Comment

by:Megan Brooks
ID: 41879281
The labeling may depend on the version of SSIS/VSTS. Adding assembly references generally is straightforward for assemblies installed in the GAC, which is evidently where the redistributable installs this set.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In a previous article I've shown you how to import data from an Excel sheet using the OPENROWSET() function (http://www.experts-exchange.com/A_3025.html).  And I concluded by stating that it's not the best option when automating your data import. …
From time to time, for debugging and troubleshooting your flow at run time you’ll need to check if the variable has the correct value or not, there’re several ways to check for the value of the variables inside the flow, You can add Break Points, a …
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now