Skip to content

This utility is used for parsing excel sheets data into java object used for Inventory Management System

License

Notifications You must be signed in to change notification settings

NeebalLearningPvtLtd/Excel-to-POJO

Repository files navigation

Excel to POJO

Description

This is utility used for parsing excel sheets data into java object used for Inventory Management System here

Dependencies

Jackson for json format to java format maven link .

Apache Poi for .xlsx ( 2007 and above excel formats ) maven link and for .xls support you need to add maven link .

Note

It can used for both .xls and .xslx file format together using this .

Usage

    • Call parseFile method of FileParser which takes excel File and json format file of how the data will be mapped in POJO
      File excelFile =new File('Absolute PATH of excel file');
    
      File JSONFormatFile =new File('Absolute PATH of JSON format file');
    
      FileParser<Inventory> fileParser = new FileParser<>(excelFile , JSONFormatFile ) ;
    
      Map<Class < ? extends Inventory > ,List<Inventory >> map = fileParser.parseFile();
    • It returns Map< Class<? extends T> , list<? extends T> > of POJO's

      • Key for the Map is the Class of the POJO .
      • Value is List of all the POJO's that are read from row of corresponding sheets

      Note

      T in my case is Inventory class which is common abstract class for all my POJO's .

  • Make sure that name of SheetFormat's name and POJO Class Name , the ColumnFormat's name and POJO's Fields name matches exactly , else SheetParsingException and RowParsingException is raised respectively .

  • Excel Sheets can be read from any index ( 0 based ) just provide index of the Sheet in JSONFormatFile like this

License

MIT

About

This utility is used for parsing excel sheets data into java object used for Inventory Management System

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published