Skip to main content

This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.

Support Article

Uploading an Excel shows data in incorrect format in Pega

SA-21554

Summary



When users are trying to upload an excel with a date column,the data is parsed as number in Pega and is throwing an error.


Error Messages



**Trying to save an invalid page : Page is not valid
.xxx.datexx : 42370 is not a valid date value
.yyy.datebb: 45670 is not a valid date value


Steps to Reproduce



1) Create an excel with a date type column.
2) Upload the excel in Pega by using MSOParseExcelFile activity to parse the excel sheet
3) Observe the above issue.


Root Cause



Excel internally saves the date type column value as double so when the MSOParseExcel activity is used to parse the excel values , it is parsing them as it is i.e a double value and it is an expected behavior.
 

Resolution



To overcome this developer need to convert the decimal value again back to the date value for this developer need to write the custom java code by using  Apache POI libraries

below is the code snippet which can fix the issue.

java.util.date.excelDate=com.pega.apache.poi.ss.usermodel.DateUitil.getjavaDate(xxdate);

ClipboardProperty cp_propvalue=myStepPage.getProperty("xxdate");

cp_propvalue.setValue(excelDate);

Published April 1, 2016 - Updated October 8, 2020

Was this useful?

100% found this useful

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us