This is code
This is my error:
Exception in thread "main" org.apache.poi.poifs .filesystem.officeXmlFileException:The supplied data appears to be Office 2007+Xml Your are calling the part of Poi that deals with ole2 office Documents. You need to call a different part of POI to process this data (Eg XSSF insted of HSSF)
at org.apache.poi.poifs.storage.headerBlock.<init><He aderBlock,java:131>
and Iam using 3.8 beta4 version of jar file
Code:
import java.io.FileInputStream;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
public class PS
{
public static void main(Strings args[])
{
InputStream filename = new FileInputStream("D:/sathish/Example.xlsx");
XSSFWorkbook wb= new XSSFWorkbook(filename);
XSSFSheet sheet = wb.getSheetAt(0);
XSSFRow row1 = sheet.getRow(0);
XSSFCell a1= row1.getCell(0);
String a1val= a1.getStringCellValue();
XSSFCell a2= row1.getCell(1);
String a2val=a2.getStringCellValue();
XSSFCell a3= row1.getCell(2);
String a3val=a3.getStringCellValue();
System.out.println("A1: " + a1val);
System.out.println("B1: " + a2val);
System.out.println("C1: " + a3val);
}
}
Exception in thread "main" org.apache.poi.poifs .filesystem.officeXmlFileException:The supplied data appears to be Office 2007+Xml Your are calling the part of Poi that deals with ole2 office Documents. You need to call a different part of POI to process this data (Eg XSSF insted of HSSF)
at org.apache.poi.poifs.storage.headerBlock.<init><He aderBlock,java:131>
and Iam using 3.8 beta4 version of jar file