lundi 19 octobre 2020

Read Write Excel File using selenium

I am getting error like [ Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/collections4/ListValuedMap at excelExport.ReadWriteExcel1.main(ReadWriteExcel1.java:15)) ] . Can Someone please guide me for the same.

package excelExport;

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

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

public class ReadWriteExcel1 
{
    public static void main (String []args) throws Exception
    {
        File src=new File("C:\\Users\\techbrain\\Downloads\\Selenium Jar\\TestData.xlsx");
        FileInputStream fis = new FileInputStream(src);
        XSSFWorkbook wb=new XSSFWorkbook(fis);
        XSSFSheet sheet=wb.getSheetAt(0);
          
        int rowcount=sheet.getLastRowNum()+1;
        System.out.println("Total rows is "+rowcount);
        for(int i=0; i<rowcount; i++)
        {
            String data0=sheet.getRow(i).getCell(0).getStringCellValue();
            System.out.println("Data from Row"+i+" is "+data0);
        }
         wb.close();
    }
}

enter image description here

Aucun commentaire:

Enregistrer un commentaire