I understand that we can create model class whose each instance variable will be bound to each excel column like below
class emp{
String name;
String empId;
//getter and setter method of each
}
excel file:
name | empid
abc | 123
bcd | 3232
xyz | ee32
how to handle this case when number of column in excel increases dynamically
I would doing this using a kind of table model. A
ExcelTableModel
similar to the javax.swing.table.DefaultTableModel.Complete example showing a blueprint of this approach:
The first sheet in
ExcelFile.xlsx
can be something like this:As you see, the table will be got from the used range and the first row of the used range will be got as column names.