function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
GurunathGurunath 

How to download Xl file for SOQL Output

Please anyone suggest me solution for this issue (Except renderedAs)

Abhi_TripathiAbhi_Tripathi
Hey,

You have SOQL in your controller

here is the easiest method

you can write a page with "contentType" and append that list having records like in below page

<apex:page controller="SendExcelFileMonthly"  contentType="application/x-excel#filename.xls">
   
    <apex:pageBlock >

<!-- List having queried data -->
        <apex:pageBlockTable value="{!companies}" var="comp">
       
            <apex:column value="{!comp.Name}"/>
            <apex:column value="{!comp.Module_Name__c}"/>
            <apex:column value="{!comp.Project__c}"/>
            <apex:column value="{!comp.Status__c}"/>
            <apex:column value="{!comp.Task_Date__c}"/>
            <apex:column value="{!comp.Task_Detail__c}"/>
            <apex:column value="{!comp.Task_Name__c}"/>
            <apex:column value="{!comp.Hours__c}"/>
     
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:page>

Regards,
Abhi Tripathi
Salesforce Developer