cancel
Showing results for 
Search instead for 
Did you mean: 

Regarding The Copying of Data from Excel 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 (1)

Accepted Solutions (1)

former_member187990
Participant
0 Kudos

Hi,

The Exception rasied may be due to incompatable version.

Try to save your Excel file in the format 97-2003 and Try.

http://www.archivesat.com/JExcelApi/thread362381.htm

Satish Kumar SV

Former Member
0 Kudos

<b>Hi Satish

Thanks for your reply.

The problem was solved.

Regards

Chandran</b>

Answers (1)

Answers (1)

Former Member
0 Kudos

Chandran,

please ensure, that the file you're trying to open is really an Excel (e.g. binary and not a text) file. Excel is capable of opening any structured text file (separated by tab, commata...), JXL is only able to handle the "real" binary Excel format.

Try opening the file with the Notepad.

Regards

Stefan

Former Member
0 Kudos

<b>Hi Stefan

Thanks for your Reply

Actually There are three columns in the Excel File (Eg..Name,EmpNo,Salary)

I want these things to to be copied to Web dynpro table.

I am using the Microsoft Office 2007 for creating Excel file.

Regards

Chandran

</b>