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

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

Chloe Bennett

Culture, Media & Entertainment Columnist

Chloe Bennett explores the intersection of pop culture, streaming entertainment, digital trends, and contemporary lifestyle. Her weekly commentary reaches thousands of culture enthusiasts.

Share this article
Twitter Facebook Pinterest