Message Boards

Validate an uploaded excel sheet

Shreya Tiwari, modified 4 Years ago.

Validate an uploaded excel sheet

New Member Posts: 6 Join Date: 1/29/20 Recent Posts
Can somebody guide on how to validate an uploaded excel sheet. Validations like empty cell, column values not as expected data type, etc.
thumbnail
David H Nebinger, modified 4 Years ago.

RE: Validate an uploaded excel sheet

Liferay Legend Posts: 14914 Join Date: 9/2/06 Recent Posts
How would you do it if Liferay wasn't part of the mix?
Shreya Tiwari, modified 4 Years ago.

RE: Validate an uploaded excel sheet

New Member Posts: 6 Join Date: 1/29/20 Recent Posts
Haven't done that before. Looking for suggestions! That is part of my next sprint. Would be easy if got a little lead emoticon
thumbnail
Mohammed Yasin, modified 4 Years ago.

RE: Validate an uploaded excel sheet

Liferay Master Posts: 591 Join Date: 8/8/14 Recent Posts
You might be using Apache Poi for reading excel ?? If yes then you can check cell value you can refer below https://tutorial.techaltum.com/read-excel-data-with-Apache-POI.html
thumbnail
David H Nebinger, modified 4 Years ago.

RE: Validate an uploaded excel sheet

Liferay Legend Posts: 14914 Join Date: 9/2/06 Recent Posts
Mohammed's path is the one I'd use. Basically leverage POI to check everything you want to check for.

I'd have a method that knows how to validate a row, then I'd open the sheet and for each row that would be processed invoke the validation method for it.
Shreya Tiwari, modified 4 Years ago.

RE: Validate an uploaded excel sheet

New Member Posts: 6 Join Date: 1/29/20 Recent Posts
Thanks for the lead, Mohammad and David! I am now able to iterate through each cell value and validate accordingly!