0

I have an excel file with one or two sheets and 30K+ rows in each sheet. I need to parse each row into a DTO, then generate a unique number for each of them and then store everything in DB.

I can convert data to DTOs in 2 ways:

  1. Either, read data directly from excel using Apache.poi,
  2. Or, import data into DB (using DB Tools) and read from DB (by creating appropriate entity and then converting it to DTO).

My questions is: which option is preferable/optimal/faster/better?

My concern is that reading from excel would be slower but each row could have about 100 cells so creating the appropriate table and entity class with those fields may also take time considering that the functionality may be executed very seldom.

Armine
  • 1,675
  • 2
  • 24
  • 40

1 Answers1

0

IMO best approach will be using apache-poi. You can use this link [1], on how to do it.

Because if you are going to store everything to a DB will take considerable amount of time and then again you have to generate DTO by reading the data tables.

[1] How to convert my xlsx sheet to java object using Apache POI

Pramodya Mendis
  • 686
  • 8
  • 24