+ Start a Discussion
Samuel RobertSamuel Robert 

How to Export All reports in one Excel sheet and send an Email.

Hello Team, 

As i was researching here i was able to find Schedule or Batch  for attaching one report doc and sending mail to the user., However my requirement is How to get all reports in one Excel Attachment and send a mail to the user.

"This is my Code now im stuck with what i shoud do in the Execute to get all the reports in one excel attachment"
 
global class ScheduleBatchReports implements Database.batchable<sObject>
{

    global Database.QueryLocator start(Database.BatchableContext BC)
    {
         
        String crpt = 'SELECT Name FROM Report';
        return Database.getQueryLocator(crpt);
    }
   
    global void execute(Database.BatchableContext BC, List<Report> scope)
    {
        for(Report r : scope){} 
        
        
             }    
   
    global void finish(Database.BatchableContext BC)
    {
    }
   
}

Guys please assist me, ASAP.

Thanks in Advance.