Question

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)
-

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.

@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

@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 ?

Hello @PrabakaranSoundararajan,
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

@danprashant Thanks prashant, Great that it worked for 7.3 as well.

@PrabakaranSoundararajan Hi, Will you be able to share the java code snippet to read the mail attachment xls. Thanks in advance

@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.

I too have same requirement for one of the user story.
Could you please share steps, that could help me.
Thanks

@danprashant, Can you please share me the code that you have changed in pxParseExcelFile to get Pagelist using stream.
Thanks

@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

@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