0

I am developing one spring boot application. Where I am having one input excel file. I have converted that file into .csv format. Now I am accessing the columns by index values but I want to access them with using headers. With using application.properties how it is possible?

Thanks in advance.

Ruchita
  • 23
  • 1
  • 9

1 Answers1

0

You should create a enum of header name with index as value. Use this enum instead of index in your code.

public enum headers{
     col1(0), col2(1);
     private int index;
     public headers(int i){
            this.index=i;
       }
}

///Use like:

getColumn(headers.col1);
pdubey
  • 33
  • 3