locked
Export a Saved Query to Excel Programmatically in CRM 2011 RRS feed

  • Question

  • Hi All,

    Is there a way to export a saved query to Excel programmatically in CRM 2011?

    What I'm after is, a method to download the exported Excel file (with data based on the query) directly from CRM without having to construct it from scratch.

    There are examples on how to import data into CRM but I was unable to find a solution to export data programmatically from CRM.

    Thanks in Advance.

    Lasa.

    Monday, February 4, 2013 12:55 AM

Answers

  • That is correct - you would have to manually parse out the XML and write it out to a file on your own using this method.

    Jason Lattimer
    My Blog -  Follow me on Twitter -  LinkedIn

    • Marked as answer by lasajay Tuesday, February 5, 2013 7:23 PM
    Monday, February 4, 2013 12:32 PM
    Moderator

All replies

  • Monday, February 4, 2013 4:03 AM
    Moderator
  • Hi Jason,

    Thanks for your help.

    Unfortunately, this method does not seem to provide me with an Excel file. It is returning the result set in XML format.

    I assume, i will have to convert this XML dataset to Excel?

    Thought there could be a easier way of doing this, given the functionality is available from the user interface.

    Thanks,

    Lasa.

    Monday, February 4, 2013 5:12 AM
  • Hello,

    You may give a try with the Data Export Manager;

    http://mscrmtoolkit.codeplex.com/documentation#dataexportmanager

    It can be used to export the query in XML, XML Spreadsheet 2003 or CSV.

    All the exported files can be directly opened in Excel. And you can even schedule the data export.

    I hope this helps.

    Zoran

    • Proposed as answer by Zoran Ivanov Monday, February 4, 2013 9:37 AM
    Monday, February 4, 2013 7:37 AM
  • This may be an unnecessarily long-winded approach, but another option (if running OnPremise) would be to use Reporting Services; create a report with your query, and you programmatically run and render this to Excel using URL Access in Reporting Services

    Microsoft CRM MVP - http://mscrmuk.blogspot.com/ http://www.excitation.co.uk

    Monday, February 4, 2013 9:00 AM
    Moderator
  • That is correct - you would have to manually parse out the XML and write it out to a file on your own using this method.

    Jason Lattimer
    My Blog -  Follow me on Twitter -  LinkedIn

    • Marked as answer by lasajay Tuesday, February 5, 2013 7:23 PM
    Monday, February 4, 2013 12:32 PM
    Moderator