"Unable to recognize OLE stream" when connecting to Excel

I tried to connect my Java program to an Excel file. I have done it. But that throws this exception

Unable to recognize OLE stream

Please help me fill this out.

import jxl.*;
import java.io.*;

public class excel
{
      public static void main(String[] args)throws Exception
      {

       File ex=new File("D:/worksps/test.xlsx");
       Workbook w= Workbook.getWorkbook(ex);
       Sheet s= w.getSheet(0);
       for(int i=0;i<s.getColumns();i++)
       {
         for(int j=0;j<s.getRows();j++)
         {
               Cell cell=s.getCell(i, j);
               System.out.println("     "+cell.getContents());
         }
         System.out.println("\n");
       }
      }
}
+5
source share
1 answer

JXL supports Excel worksheets created in Excecl 95/97 and 2000 -

Read below on the official JXL website - http://www.andykhan.com/jexcelapi/

Functions

Reads data from an Excel 95, 97, 2000 workbook. Read and write formulas (Excel 97 and later versions only) Excel 2000 format spreadsheets

Your Excel sheet is created after Excel 2000. This seems to be the problem.

Excel, Excel 2000, POI Apache. API MS Excel 97 MS Excel 2008.

+14

All Articles