Activity Forums Salesforce® Discussions Can report data be accessed programatically? Reply To: Can report data be accessed programatically?

  • Gourav

    August 26, 2016 at 8:23 am

    Hi Tanu,

    Yes, you can accessed reports in apex.

    Firstly, you can get a list of reports in XML from: (replacing instance with the actual server instance, such as na1)

    Once you have extracted the required report Id (00O key prefix) you can then request the report data in either CSV or HTML.

    HTML (Last time I checked this was HTML rather than a native Excel file format. Excel does the conversion when it is opened).

    As for working with the CSV output, I found Parse a CSV with APEX but I haven't tested it yet.

    If you want to get fancy, you can set filters for the report too. See BUILDING SALESFORCE CUSTOM LINKS - Linking to Reports for the pv0, pv1... query string parameters.


    Progmatic Access to Reports This post was from 2006, but shows that the approach has been working for a several years now. That still doesn't mean it might not work tomorrow.