我的代码是:
public class ReadExcelFile {
public static void main(String[] args) throws IOException {
FileInputStream fis = new FileInputStream("D:\\Hero Moneykit.xlsx");
XSSFWorkbook workbook = new XSSFWorkbook(fis);
XSSFSheet sheet = workbook.getSheetAt(0);
Row row = sheet.getRow(0);
Cell cell = row.getCell(0);
System.out.println(cell);
System.out.println(sheet.getRow(0).getCell(0));
}
}
我遇到错误
:线程“ main”中的异常java.lang.Error:未解决的编译问题:XSSFWorkbook无法解析为类型
答案 0 :(得分:0)
我认为您应该没有空格输入您的地址
public class ReadExcelFile {
public static void main(String[] args) throws IOException {
FileInputStream fis = new FileInputStream("D:\\HeroMoneykit.xlsx");
XSSFWorkbook workbook = new XSSFWorkbook(fis);
XSSFSheet sheet = workbook.getSheetAt(0);
Row row = sheet.getRow(0);
Cell cell = row.getCell(0);
System.out.println(cell);
System.out.println(sheet.getRow(0).getCell(0));
} }