cancel
Showing results for 
Search instead for 
Did you mean: 

Regarding The Copying of Data from Excel File to Java

Former Member
0 Kudos

Hi

I am attempting to copy the data from an excel file and here is the code for that and it is throwing an following exception. Plz kindly help me to solve this issue.

<u><b>Code</b></u>

import java.lang.*;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;

import java.util.Date;
import jxl.*;
 
public class ProjectExcel
{
    public static void main(String[] args)
    {
    	try
    	{
    		    		     		
    		Workbook workbook = Workbook.getWorkbook(new File("c:\temp\salary.xlsx"));
    
    		Sheet sheet = workbook.getSheet(0);
    	
    		Cell a1 = sheet.getCell(1,1); 
	
			String s1 = a1.getContents(); 

    	
    		System.out.println("The Cell Content in (1,1) = "+s1);

    	}
    	
    	catch(Exception E)
    	{
    		System.out.println(E.toString());
    	}
       
    }
}

<u><b>Exception Throwned</b></u>

jxl.read.biff.BiffException: Unable to recognize OLE stream

Plz Help me to solve this issue

Thanks in Advance

Regards

Chandran S

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Chandran,

since your problem was solved in the Web Dynpro for J forum, please mark this thread as solved also.

Hint for other readers: The Excel 2007 file Chandran attempted to read is not compatible for usage with JXL.

Regards

Stefan

Former Member
0 Kudos

Hi,

I think u need to change the extension of the file from <b>"*.xlsx"</b> to <b>".xls"</b> as jxl.jar i think only understands the .xls format.

If the answer solves your problens...please do reward with points.

Thanks

ritu