- #1
zak100
- 462
- 11
Hi,
I am trying to access Excel Sheet .xlsx files in Java. I have tried various options available from internet. My program is using following jar files:
poi-ooxml-3.5-beta4.jar,
openxml4j-1.0-beta.jar
I have done following imports:
import java.io.*;
import java.io.File;
//import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.usermodel.WorkbookFactory;
//import org.apache.poi.ss.usermodel.Cell;
//import org.apache.poi.ss.usermodel.CellType;
//import org.apache.poi.ss.usermodel.Row;import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import javax.swing.*;
import java.util.*;
I am getting error in the following code:
For Sheet, I am getting following error messages:
For Workbook, I am getting following error messages:
Some body please guide me.
Zulfi.
I am trying to access Excel Sheet .xlsx files in Java. I have tried various options available from internet. My program is using following jar files:
poi-ooxml-3.5-beta4.jar,
openxml4j-1.0-beta.jar
I have done following imports:
import java.io.*;
import java.io.File;
//import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.usermodel.WorkbookFactory;
//import org.apache.poi.ss.usermodel.Cell;
//import org.apache.poi.ss.usermodel.CellType;
//import org.apache.poi.ss.usermodel.Row;import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import javax.swing.*;
import java.util.*;
I am getting error in the following code:
Java:
public void readExcel() {
String FILE_PATH = "D:\\book1.xlsx";
Sheet sheet = null;[b]// Error[/b]
try {
Workbook workbook = WorkbookFactory.create(new File(FILE_PATH));[b]//Error[/b] //FileInputStream inputFS = new FileInputStream(FILE_PATH);
//Workbook workbook = WorkbookFactory.create(inputFS);
//sheet = workbook.getSheetAt(0);
}
catch (Exception e) {
}
For Sheet, I am getting following error messages:
cannot find symbol
symbol: class Sheet
For Workbook, I am getting following error messages:
cannot find symbol
symbol: class Workbook
no suitable method found for create (String)
method WorkbookFactory.create(POIFSFileSystem) is not applicable
(argument mismatch; String cannot be converted to POIFSFileSystem)
method WorkbookFactory.create(Package) is not applicable
(argument mismatch; String cannot be converted to Package)
method WorkbookFactory.create(InputStream) is not applicable
(argument mismatch; String cannot be converted to InputStream)
Some body please guide me.
Zulfi.