1

My code is :

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));
     } 
}

I am getting error

:Exception in thread "main" java.lang.Error: Unresolved compilation problems: XSSFWorkbook cannot be resolved to a type

Würgspaß
  • 4,660
  • 2
  • 25
  • 41
  • 1
    How are you getting the dependencies ? Are you using Maven (if so, please post your pom.xml). XSSFWorkbook is an Apache POI class. – Thoomas Sep 14 '18 at 07:00
  • Welcome to Stack Overflow! Other users marked your question for low quality and need for improvement. I re-worded/formatted your input to make it easier to read/understand. Please review my changes to ensure they reflect your intentions. Feel free to drop me a comment in case you have further questions or feedback for me. – GhostCat Sep 14 '18 at 07:27
  • See the duplicated question: you have an unsatisfied dependency here. That is all there is to this. You cant just start using classes from libraries, you have to ensure that the corresponding class is available when compiling or running your project. – GhostCat Sep 14 '18 at 07:28

1 Answers1

-3

I think you should be without space Enter your address

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));
 } }