Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Using a plugin to connect to a pre-existing excel file and "past as values only"?

(0) ShareShare
ReportReport
Posted on by 1,579

Is the following possible in Dynamics CRM 2011 via plugin?

I'd like to put a custom button on a ribbon that runs a plugin that runs when the button is pressed.

The plugin will need to do the following:

Receives data from a C# function/procedure containing values that have been generated via Query Expression

Then connects to a specially formatted excel spreadsheet that will be sitting out on disk, and performs the equivalent of "Pasting Values Only" column by column into that pre-existing excel spreadsheet.

The use case and requirements are very detailed so the only way to meet them is to connect to the sheet, find the first column based on the column name in the first row or a specific row I will know ahead of time, and then  "past as values" into that column,  the data obtained via query expression.

Then the process will repeat until all relevant columns are filled.

Nobody will open the spreadsheet while the process is happening, the only thing touching it will be Dynamics CRM.

If something like this is possible, can anyone provide some high level guidance as to the particulars I need to look into in order to achieve it?

Many thanks in advance for any guidance, recommendations, or assistance regarding how to approach this.

*This post is locked for comments

  • ACECORP Profile Picture
    ACECORP 1,579 on at
    RE: Using a plugin to connect to a pre-existing excel file and "past as values only"?

    Yes it does. Big help. Thanks so much!

  • Suggested answer
    Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: Using a plugin to connect to a pre-existing excel file and "past as values only"?

    If you are using CRM On-Prem, and have your Plugin in Non-Isolated mode, you can access the Excel file (if you have access to it via network).

    There are various vendors that have Excel Libraries that allow you to manipulate and query data in Excel.

    We have used Infragistics, but you can do this directly via Office SDK. You might have to install Office 2007 PIA on the server.

    You will need to make sure that any assemblies that you need to access (outside of the plugin) are either registered in the GAC or in the file system under Program Files\Microsoft Dynamics CRM\Server\bin\assembly directory.

    The rest is up to you on how to manipulate the Excel file.

    I would test this running a console app and make sure that I get the results I want, and only then deploy the logic to plugin. Much easier to debug as Console Application.

    Hope this helps. Good luck.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,711 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,458 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans