Discussion

4
Replies
3168
Views
pauls1 Member since 2015 1 post
PEGA
Posted: July 29, 2019
Last activity: September 23, 2020

Export data from a data page to Excel

Exporting data from a data page to Excel

 

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)

 

  1. Create a template excel file and save this file locally. Note the format of the code in the braces

template excel file:

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): Uploading Binary FileCreating Binary Template

 

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:

Export to Excel Activity

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:

Call Activity in Button

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:

export to excel Button

 

export to excel after clicking button

Excel After export

Pega Platform Low-Code App Development Low-Code App Development Dev/Designer Studio Reporting Senior System Architect Developer Knowledge Share
Share this page LinkedIn