{"id":137,"date":"2013-11-19T07:10:37","date_gmt":"2013-11-19T07:10:37","guid":{"rendered":"http:\/\/www.greytrix.com\/blogs\/salesforce\/?p=137"},"modified":"2025-05-15T09:15:45","modified_gmt":"2025-05-15T09:15:45","slug":"excel-export-in-salesforce","status":"publish","type":"post","link":"https:\/\/www.greytrix.com\/blogs\/salesforce\/2013\/11\/19\/excel-export-in-salesforce\/","title":{"rendered":"Excel Export in Salesforce"},"content":{"rendered":"<p style=\"text-align: justify;\">In one of our last posts &#8220;<a title=\"PDF Export in Salesforce\" href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2013\/11\/08\/pdf-export-in-salesforce\/\" target=\"_blank\" rel=\"noopener\">PDF Export in Salesforce<\/a>&#8220;, we described how to download data in PDF format in Salesforce. Now we will be describing how to download data in excel format as promised in our previous blog. On the same pattern as PDF; <b>contentType=&#8221;application\/vnd.ms-excel#Export.xls&#8221; <\/b>is the tag used to download the salesforce page in Excel format. In this blog we will discuss the Excel download functionality without redirecting to another page.<\/p>\n<p style=\"text-align: justify;\">We will start by assigning the variable a value in java-script which will be the desired output in excel. The <b>exportDataString<\/b> is the text\/html variable that we are assigning in JavaScript.<\/p>\n<p><span style=\"color: #000000;\"><em><strong>New Stuff<\/strong><\/em>:<\/span>\u00a0\u00a0<a title=\"Changing the date range in standard Salesforce Calendar\" href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2013\/11\/07\/changing-the-date-range-in-standard-salesforce-calendar\/\" target=\"_blank\" rel=\"noopener\">Changing the date range in standard Salesforce Calendar<\/a><\/p>\n<p style=\"text-align: justify;\">Below is a sample code for the main VF page and its controller &#8211;<a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2013\/11\/Excel1.jpg\"><img fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter size-full wp-image-140\" src=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2013\/11\/Excel1.jpg\" alt=\"Excel1\" width=\"993\" height=\"409\" \/><\/a>Next we create an <b>excel_demoexport<\/b> Page having the same controller as in Main Page that will be returned to the main page to download the data in Excel format.<\/p>\n<p>We need to set the contents of <b>exportDataString <\/b>in the page <b>Excel_demoexport <\/b>as in <b>&lt;apex:outputText&gt;<\/b> tag. Note that we have used the set <b>escape<\/b> attribute to false as shown below &#8211;<b><\/b><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2013\/11\/Excel2.jpg\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-141\" src=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2013\/11\/Excel2.jpg\" alt=\"Excel2\" width=\"922\" height=\"153\" \/><\/a>Using the above steps, you can optimize the excel export feature for huge data as well.<\/p>\n<p><span style=\"font-size: Medium;\"><strong>About Us<\/strong><\/span><br \/>\n<a href=\"https:\/\/www.greytrix.com\/\">Greytrix<\/a> as a Salesforce Product development partner offers a wide variety of integration products and services to the end users as well as to the Partners across the globe. We offers Consultation, Configuration, Training and support services in out-of-the-box functionality as well as customizations to incorporate custom business rules and functionalities that requires apex code incorporation into the Salesforce platform.<\/p>\n<p><a href=\"https:\/\/www.greytrix.com\/\">Greytrix<\/a> has some unique solutions for Cloud CRM such as Salesforce integration with <a href=\"https:\/\/www.greytrix.com\/product\/sage-x3\/gumu-x3-salesforce-integration\">Sage Enterprise Management (Sage X3<\/a>), Sage Intacct, <a href=\"https:\/\/www.greytrix.com\/product\/sage-100-erp\/gumu-100-salesforce-integration\">Sage 100, <\/a>and <a href=\"https:\/\/www.greytrix.com\/product\/sage-300-erp\/gumu-300-salesforce-integration\">Sage 300 (Sage Accpac)<\/a>. We also offer best-in-class Cloud CRM <a href=\"https:\/\/www.greytrix.com\/product\/crm-development\/salesforce-com\">Salesforce customization and development services<\/a> along with services such as Salesforce <a href=\"https:\/\/www.greytrix.com\/product\/professional-services\/data-migration-services\">Data Migration<\/a>, <a href=\"https:\/\/www.greytrix.com\/product\/professional-services\/integrated-application-development\">Integrated App development<\/a>, <a href=\"https:\/\/www.greytrix.com\/product\/professional-services\/custom-development\">Custom App development<\/a>, and <a href=\"https:\/\/www.greytrix.com\/product\/professional-services\/maintenance-support\">Technical Support<\/a> to business partners and end users.<\/p>\n<p>Greytrix GUMU&#x2122; integration for Sage ERP \u2013 Salesforce is a 5-star app listed on <a href=\"https:\/\/appexchange.salesforce.com\/listingDetail?listingId=a0N30000000psM5EAI\" target=\"_blank\" rel=\"noopener\">Salesforce AppExchange<\/a>.<\/p>\n<p>For more information, please contact us at <a href=\"mailto:salesforce@greytrix.com\">salesforce@greytrix.com<\/a>. We will be glad to assist you.<\/p>\n<p><strong><span style=\"font-size: Medium;\">Related Posts<\/span><\/strong><\/p>\n<ul>\n<li><a title=\"Get Key Prefix\/Object id of Object in JavaScript\" href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2013\/11\/02\/get-key-prefixobject-id-of-object-in-javascript\/\" target=\"_blank\" rel=\"noopener\">Get Key Prefix\/Object id of Object in JavaScript<\/a><\/li>\n<li><a title=\"Mapping custom lead fields to standard contact fields\" href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2013\/11\/01\/mapping-custom-lead-fields-to-standard-contact-fields\/\" target=\"_blank\" rel=\"noopener\">Mapping custom lead fields to standard contact fields<\/a><\/li>\n<li><a title=\"Overriding standard visual page styling in Salesforce\" href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2013\/10\/23\/overriding-standard-visual-page-styling-in-salesforce\/\" target=\"_blank\" rel=\"noopener\">Overriding standard visual page styling in Salesforce<\/a><\/li>\n<li><a title=\"Assign custom object permissions to Standard User in Salesforce\" href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2013\/06\/11\/assign-custom-object-permissions-to-standard-user-in-salesforce\/\" target=\"_blank\" rel=\"noopener\">Assign custom object permissions to Standard User in Salesforce<\/a><\/li>\n<li><a title=\"Mapping Custom Lead Fields in Salesforce\" href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2013\/08\/23\/mapping-custom-lead-fields-in-salesforce\/\" target=\"_blank\" rel=\"noopener\">Mapping Custom Lead Fields in Salesforce<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>In one of our last posts &#8220;PDF Export in Salesforce&#8220;, we described how to download data in PDF format in Salesforce. Now we will be describing how to download data in excel format as promised in our previous blog. On the same pattern as PDF; contentType=&#8221;application\/vnd.ms-excel#Export.xls&#8221; is the tag used to download the salesforce page\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2013\/11\/19\/excel-export-in-salesforce\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[120,121,558,559],"class_list":["post-137","post","type-post","status-publish","format-standard","hentry","category-salesforce-srv","tag-excel","tag-excel-export","tag-excel-export-in-salesforce","tag-excel_demoexport"],"_links":{"self":[{"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/posts\/137","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/comments?post=137"}],"version-history":[{"count":3,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/posts\/137\/revisions"}],"predecessor-version":[{"id":10749,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/posts\/137\/revisions\/10749"}],"wp:attachment":[{"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/media?parent=137"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/categories?post=137"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/tags?post=137"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}