How to fix "XSSFWorkbook cannot be resolved to a type"? [duplicate]

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

3

1 Answer

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

You Might Also Like