open an existing excel file in java apache poi
import java.io.File;
import java.io.FileInputStream;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
public class GFG {
public static void main(String args[]) throws Exception
{
// Create a file object
// for the path of existing Excel file
// Give the path of the file as parameter
// from where file is to be read
File file = new File("Geeks.xlsx");
// Create a FileInputStream object
// for getting the information of the file
FileInputStream fip = new FileInputStream(file);
// Getting the workbook instance for XLSX file
XSSFWorkbook workbook = new XSSFWorkbook(fIP);
// Ensure if file exist or not
if (file.isFile() && file.exists()) {
System.out.println("Geeks.xlsx open");
}
else {
System.out.println("Geeks.xlsx either not exist"
+ " or can't open");
}
}
}
Also in Java:
- islowercase java
- code to include layout from java in android
- instantiate optinal java 8
- detect tv remote keys andoid studio
- java change boolean to opposite
- change button color java swing
- Fab to CircularRevealFrameLayout example
- java define a generic class that produces
- error message pushes button down
- JavaFX mouse over effe
- get drawable with string android java
- guess the number java
- how to declare array java
- copy file with byte java
- java prev permutation
- waht does&& mean in java
- two dimensional array in java example program
- java stack pop
- android studio keep device awake
- how to count the number of occurrences of an element in a arraylist in java
- spigot repeating task
- how to remove all components from layeredPane java
- partial view tiles spring
- java hello world