Upload data by using file listener combines with MSOParseExcelFile
To upload data by using an excel spreadsheet can be done by MSOParseExcelFile. The activity takes two mandatory properties, one is the name of the template file and the other one is the location and name of the uploaded excel file. The details steps of how to configure can be found here: https://pdn.pega.com/configuring-application-bulk-upload-data-using-excel-spreadsheet
When the parsing part is solved it will be great to make this automatically, Instead of uploading files one by one manually, it saves efforts to have a file listener monitors a folder and uploads files inside the folder when they are available. Here are the steps to set up the file listener and call MSOParseExcelFile to do the parsing.
- Create a Service File from Records→Integration-Services→Service File. Give it proper label, customer package name and customer class name.
- Configure the service file created.
- In Method tab, choose Processing method as "file at a time" and Data mode as "text only" since we are going to call MSOParseExcelFile to parse the file as a whole.
- In the Request tab, specify initial activity if needed. Skip the Parse segments and specify the final activity. One trick here is when the activity calls MSOParseExcelFile, I modified PRInputStream to java.io.FileInputStream in steps 3 java code to read uploaded file from an absolute path
- Also, the parameter TemaplateFRB for the MSOParseExcelFile activity, it follows the format: "webwb!TemplateName!xlsx"
- Create a file listener to monitor a folder and call the file service to parse the file content.
- Configure the listener node, source location and source name mask.
- Listener properties section will be the service file created in above steps 1 and 2.
- Provide Requestor login if required.