web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Create Excel Sheet in C# Plugin/Workflow

(0) ShareShare
ReportReport
Posted on by

Hi Community, 

Is there a supported way for D365/CRM online to export data to an Excel-File in C# Plugin/Workflow and attach this to a note?

So far, I found only unsupported ways or ways which use ILMerge to merge in external DLLs (which is not directly supported from what I read!) for the Excel-Part. For the attach to note part, there are sources provided by Microsoft. So what I'm missing is the Excel-Part.

Thanks in advance

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Shahbaaz Ansari Profile Picture
    6,211 on at

    why you want to do it with plugin, you can go to advance find, write your query and run the query, it will give you option to export the data in excel.

  • Temmy Wahyu Raharjo Profile Picture
    2,916 on at

    Hi, this one I think will be very hard if you run it on online. Because all plugin in dynamic crm online should in sandbox and I don't know weather we can create file from inside the plugin or not.

    But for theory, you can used another third party like https://www.nuget.org/packages/ExcelLibrary/. Choose small library because Dynamic CRM has limitation for the size.

  • Tobias Majunke Profile Picture
    on at

    Shahbaaz Ansari:
    We have to combine multiple Exports and the customer want to automate this.

    E.G. Run 1 Workflow for each Account. This workflow should accumulate all data from the account's contacts and attach this to an note and email to send it to the account responsible.

    Temmy Wahyu Raharjo:

    I tried it with an txt file and it worked. I created it as a Memory Stream and saved it as an CRM attachment. 

    For online you have the problem to register any third party library unless it's merged or integrated by Microsoft

  • Suggested answer
    Alex Fun Wei Jie Profile Picture
    33,628 on at

    Hi,

    have you consider to use document generation?

  • Tobias Majunke Profile Picture
    on at

    We considered this already, but it's required to have a dynamic approach for fields and relations. So e.g. a new field is added, then it should add this field without any extra time for editing this in Word.

    So we need it dynamically appending new fields and removing old ones (it's literally a list of fields and it's content per entity and child entity etc).

  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at

    Hi Tobias,

    Could you please check below post - similar requirement has been verified.

    community.dynamics.com/.../261221

  • Tobias Majunke Profile Picture
    on at

    Hi Goutam,

    I already read this post. Sadly the Linkt from John Grace don't work and the solution Jorge Gomez used is very time intensive for my case, since I have dynamic field lists and can't completly generate the C# code. And therefor I wanted to know if an ready to use function or a less complicated way exists.

  • Suggested answer
    Temmy Wahyu Raharjo Profile Picture
    2,916 on at

    Tobias, you can used IlRepack:

    www.nuget.org/.../ILRepack

    In your csproj, add this command line to auto merge it everytime you build your application:

    <Target Name="AfterBuild">

       <ItemGroup>

         <InputAssemblies Include="$(TargetPath)" />

         <InputAssemblies Include="$(TargetDir)[dll merge no 1].dll" />

         <InputAssemblies Include="$(TargetDir)[dll merge no 2].dll" />

       </ItemGroup>

       <ItemGroup>

         <KeyFile Include="$(ProjectDir)[project_key].snk" />

       </ItemGroup>

       <Exec Command="$(ILRepack) /keyfile:@(KeyFile) /parallel /out:$(TargetPath) /lib:$(TargetDir) @(InputAssemblies -> '%(Identity)', ' ')" />

     </Target>

    Let me know if you have question.

  • Suggested answer
    RaviKashyap Profile Picture
    55,410 Moderator on at

    Hi Tobias,

    The supported way would be to use Excel Templates but as you mentioned you need would need to change the template if you add a new field.

    You could still use IL Merge as it doesn't have any direct implication. (I know it is mentioned as unsupported which I think is because IL Merge is not a dynamics product)

    Hope this helps.

  • Suggested answer
    Community Member Profile Picture
    on at

    I suggest you to have a look at zetexcel.com, zetpdf.com.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans