Solved

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

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

Accepted Solution

by:
Megan Brooks earned 500 total points
Comment Utility
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
Comment Utility
That was helpful.  I installed the Primary Interop Assemblies Redistributable and it showed up under COM/Type Libraries opposed to Assemblies
0
 
LVL 13

Expert Comment

by:Megan Brooks
Comment Utility
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Expressions are in essence, code. If you had an expression 2 + 2 it would evaluate to 4. A string expression of “Hello” + “ “ + “World” would evaluate to “Hello World”. Expressions are an excellent choice for working with dynamic variables, espec…
Lessons learned during ten years of interviewing for SQL Server Integration Services (SSIS) and other Extract-Transform-Load (ETL) contract roles and two years of staff manager interviewing contractors.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

772 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

10 Experts available now in Live!

Get 1:1 Help Now