Solved

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

Posted on 2016-11-08
3
41 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

776 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