In this program we are going to select the excel sheet using java .You can create any number of sheets and you can set selected sheet .
The package we need to import is java.io.* ,org.apache.poi.hssf.usermodel.HSSFSheet,
java.util.* and org.apache.poi.hssf.usermodel. HSSFWorkbook.
You can create any number of sheets and give the name of the sheet. You can set default selected sheet by using setSelected (Boolean value). The sheet which you want to select setSelected(True) and pass false for rest others sheets.
You can pass cells and rows values into sheets. And also you can set it selected.
In this example we have created six sheets and given its names and we setSelected(true) for "third sheet" and setSelected( flase) for rest. The selected sheet will displayed as shown in output of program .
The code of the program is given below:
The output of the program is given below:
Liked it! Share this Tutorial