+ Start a Discussion
Raj R.Raj R. 

How to use Ant Migration Tool to run a report and export the data to a xls file?

Hi,
We are trying to automate the exporting of a report to xls file rather than manually doing it through the UI. 

I am currently using the Ant Migration Tool to export the metadata for a particular report (i.e. "ExampleReport") and save the metadata in file "ExampleReport.report" file. The ".report" file is basically an xml format and contains the columns and filter for the report. 

How can i use this ExampleReport.report file to extract the data resulting from the report and save it as an xls file? Would i be able to use the Ant migration tool or would i have to use something like java to do this?

ExampleReport.report file
<?xml version="1.0" encoding="UTF-8"?>
<Report xmlns=".../metadata">
         <columns>
                   <field>Account_Name</field>
         <columns>

         <filter>
                <booleanFilter> 1 OR 2 </booleanFilter>
                <criteriaItems>
                          <columns> Opportunity.Name</columns>
                                  <operator>contains</operator>
                         <value>some_value</value>
              <criteriaItems>
                          <columns> Account.Name</columns>
                                  <operator>contains</operator>
                         <value>some_value</value>
             </criteriaItems>
         </filter>

         /* there are some other items, but for the sake of the length, i am omitting for now */
</report>

 
Best Answer chosen by Raj R.
@Karanraj@Karanraj
Using Ant tool you can able to extract the meta data information not the actual data. I suggest you to take a look into the salesforce report api which will gives the report data along the schema in jSon string formate.

https://developer.salesforce.com/docs/atlas.en-us.api_analytics.meta/api_analytics/

You can also schedule a report while run in the scheduled time and provide you the result in email in the html formate