In order to export data from a data page to an excel spreadsheet, you’ll need to first have a data page set up. You’ll also need to create a template excel file. This template is the structure of the excel file that the data is exported to. The below steps go through the steps of creating a button on a section which calls an activity to export the page to excel.(apologies for some formatting issues)
Create a template excel file and save this file locally. Note the format of the code in the braces
2. Upload the template excel file as a binary file to Pega. In this case, we used “excel” as the App name (Directory), and the file type (extension) as xlsm (there’s a typo in my screen shot, as it is xlsx):
3. Create an activity to upload the data from the data page to the excel template, which will then be exported locally. Note the Method Parameters on the Page-Copy step, as well as the step page. Step 3 is commented out due to the OOTB method “MSOGenerateExcelFile” being deprecated for Pega 8. The new/current method is called “pxGenerateExcelFile.” Also, keep in mind of the format for the templateRFB. It is directory!Filename!xlsx, for example, “excel!MyExcelSheet!xslx”. Make sure “DownloadFile” is checked:
4. Now that your activity is created, You’ll need to create a button with an on click event to call the activity and generate the export. You’ll need to have the action be an open URL from a new window. This will let you click on your downloaded excel file and view it:
5. After this is done, you should be all set. Launch/Run your case, click on the export to excel button you just created, and you should see your downloaded file in a new window. Click on the file, and it will open up in Excel. The file should match your template. Be sure to validate that your data is correct:
I configured like as you mentioned . but i was using MSOFileTransferButton for download.But Actually my requirement is to just download the excel. Since the images are not clear i couldn't download the file. But when i ran the activity it works and file is downloaded. I need the same behaviour when i click the button in section.
Posted: 2 years ago
Posted: 8 May 2020 3:30 EDT
David Ignacio Conde (DavidI25)
Indra Sistemas SA
Indra Sistemas SA
How to use MSOGenerateExcelFile export DateTime to format dd/MM/yyyy HH:mm:ss?
I want to export data from report definition with OOTB Function "MSOGenerateExcelFile", Then I have problem when I export with DateTime Properties. It's always export DateTime properties in format GMT.
Posted: 1 year ago
Updated: 1 year ago
Posted: 20 May 2021 9:10 EDT Updated: 20 May 2021 9:57 EDT
Abhilash BLR (AbilashBLR)
Lead System Architect
Before you pass the page for creating excel , see if you can format the property to datetime as per your requirement and hold it in temp property and use temp property in excel template which you uploaded as binary.