Question
Accenture Brazil
BR
Last activity: 29 Oct 2021 8:21 EDT
How to read Excel sheet attached from email listener and copy to Clipboard
I have a requirement that I need to read an excel attachment file through email listener and want to copy the values to clipboard. How can I do it in Pega 8.4?
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Incessant Technologies Pvt.Ltd
AU
Hello,
Pega stores the Attachments that are received as part of the Email Listener processing in pyAttachmentPage of class Data-ServiceMessage. Under this page pyAttachNames is the Value List that contains the list of attachment names and pyAttachValues is the value list that contains the data corresponding to the attachment name. Loop the pyAttachNames and identify the file is excel based on file name extension and read the stream. Once stream is available use Apache POI library for parsing the stream and map the values to clipboard.
Barclays US
US
@Jonathan Pereira Hello Jonathan, I just completed a similar requirement few hours ago.
If my understanding is correct, you want to parse an excel sheet attached to an incoming email. If yes, you need to create an activity similar to pxParseExcelFile and modify the Java code to accept pyAttachStream, which contains the binary data of the excel sheet.
Hope this helps.
Regards,
Prashant
Cognizant
US
@danprashant : Hello Prashant,
Working on a similar use case, Could you please share the steps performed and also the java code snippet for reference.
Will it work for 7.3 like modifying MSOParseExcelFile will work ?
Updated: 15 Jun 2021 2:38 EDT
Barclays US
US
Hello @Prabakaran.S,
I've shared the working code with you. It should certainly work irrespective of which Pega version you are using.
I've customized the step 23 in the Java Code in pxParseExcelFile to parse the stream to pagelist.
Regards,
Prashant
-
Prabakaran Soundararajan Prashant Daniel Maxwell Samuel Nishanth rao
Cognizant
US
@danprashant Thanks prashant, Great that it worked for 7.3 as well.
Infosys Ltd
IN
@Prabakaran.S Hi, Will you be able to share the java code snippet to read the mail attachment xls. Thanks in advance
Atos
GB
@danprashant Hi Prashant, I have a similar requirement. It will be of great help if you could share the code with me. Thanks in advance.
Cognizant Technology Solutions
IN
I too have same requirement for one of the user story.
Could you please share steps, that could help me.
Thanks
Updated: 2 Jul 2021 3:47 EDT
NCS Pte Ltd
SG
@danprashant, Can you please share me the code that you have changed in pxParseExcelFile to get Pagelist using stream.
Thanks
Infosys Ltd
IN
@danprashant We have similar requirement of reading excel from email attachment and updating the data table. will you be able to share the code. Thanks in advance
Barclays US
US
@danprashant Please follow this link - https://collaborate.pega.com/discussion/reading-excel-attachment-email, where I have created a discussion with the detailed steps to achieve this functionality.
Regards,
Prashant