I have an error "the method Getworkbook(file) in the type workbook is not applicable for the arguments (string)" in the following code. I precise that there is another class before ReadExcel which opens an internet browser and go till a form. My objective is to fill a form with excel. ANy advices would help, I am at the very beginning of my Java learning.
Thanks,
class ReadExcel {
private String inputFile;
public void setInputFile(String inputFile) {
this.inputFile = inputFile;
}
public void read() throws IOException {
File inputWorkbook = new File(inputFile);
Workbook w;
try {
w = Workbook.getWorkbook("C:\\Users\\mahfo\\eclipse-workspace\\Download\\uketsukebango_list.xlsx");
// Get the first sheet
Sheet sheet = w.getSheet("Sheet1");
// Loop over first 10 column and lines
for (int j = 0; j < sheet.getColumns(); j++) {
for (int i = 0; i < sheet.getRows(); i++) {
Cell cell = sheet.getCell(1, 1);
CellType type = cell.getType();
if (type == CellType.LABEL) {
System.out.println("I got a label "
+ cell.getContents());
}
if (type == CellType.NUMBER) {
System.out.println("I got a number "
+ cell.getContents());
}
}
}
} catch (BiffException e) {
e.printStackTrace();
}
}
public static void main(String[] args) throws IOException {
ReadExcel test = new ReadExcel();
test.setInputFile("C:\\Users\\mahfo\\eclipse-workspace\\Download\\uketsukebango_list.xlsx");
test.read();
}
}