简体   繁体   中英

The method getSheetAt(int) from the type XSSFWorkbook refers to the missing type XSSFSheet

I have imported all jar files of apache poi in the project build path, but im still getting error "The method getSheetAt(int) from the type XSSFWorkbook refers to the missing type XSSFSheet". '

Im using version- poi-bin-4.1.2-20200217

Code:

ackage ReadExcelData;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;

import org.apache.poi.xssf.usermodel.XSSFWorkbook;

public class ReadExcel {

    /**
     * @param args
     * @throws Exception 
     */
    public static void main(String[] args) throws Exception {
        // TODO Auto-generated method stub

        
        File src = new File("C:\\Users\\Vishwa\\Desktop\\DeskTop\\Projects\\Automation Projects\\TestData.xlsx");
        
        FileInputStream fis = new FileInputStream(src);
        
        XSSFWorkbook wb = new XSSFWorkbook(fis);
                
        
        wb.getSheetAt(0);  //Error here: The method getSheetAt(int) from the type XSSFWorkbook refers to 

                            the missing type XSSFSheet  ,  

  The type org.apache.poi.xssf.usermodel.XSSFSheet cannot be resolved. It is indirectly referenced from required .class files
        
        
    }

Do you have

<dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi-ooxml</artifactId>
    <version>4.1.2</version>
</dependency>

In your pom.xml if you are using maven?

Or add this jar f you have a lib

https://repo1.maven.org/maven2/org/apache/poi/poi-ooxml/4.1.2/ .

poi-ooxml-4.1.2.jar

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM