while importing excel data i am getting this error
jxl.read.biff.BiffException: Unable to recognize OLE stream
Note: my datas in excel are of type xml spreadsheet.
can u please help me?
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
while importing excel data i am getting this error
jxl.read.biff.BiffException: Unable to recognize OLE stream
Note: my datas in excel are of type xml spreadsheet.
can u please help me?
Wll I've never used the excel API you are using so I would have no clue why you are seeing that exception, have you tried this with a pre 2007 excel file which is not XML?
See if that works and if it does my conclusion would be that the api you are using isnt able to read the XML version, or maybe it is but you aren't calling the right piece of code for it.
It would also be nice if you could show us your code and the full stack trace.
Cheers!
Edit: I just had a read at jexcelapi's website and it says the following.
I cant find anywhere it says it is able to read the 2007 version (XML).Reads data from Excel 95, 97, 2000, XP, and 2003 workbooks
Reads and writes formulas (Excel 97 and later only)
Generates spreadsheets in Excel 2000 format
Supports font, number and date formatting
Supports shading, bordering, and coloring of cells
Modifies existing worksheets
Is internationalized, enabling processing in almost any locale, country, language, or character encoding (formulas are currently only supported in English, French, Spanish, and German, but more can be added if translated)
Supports copying of charts
Supports insertion and copying of images into spreadsheets
Supports logging with Jakarta Commons Logging, log4j, JDK 1.4 Logger, etc
...and much more
// Json
Last edited by Json; October 19th, 2009 at 03:01 AM.
hey thanks .
If i save the file with type as Excel Workbook, my code is working fine.
Also please suggest if i could use someother api...
I have attached the code and stacktrace also.
try {
Workbook wb = Workbook.getWorkbook(fp);
Sheet sheet = wb.getSheet(0);
int columns = sheet.getColumns();
int rows = sheet.getRows();
String data = null;
for(int row = 0;row < rows;row++) {
for(int col = 0;col < columns;col++) {
data = sheet.getCell(col, row).getContents();
System.out.println("data====="+data);
// Your code here
}
}
} catch(Exception ioe) {
System.out.println("Error: " + ioe);
ioe.printStackTrace();
}
StackTrace is:
Error: jxl.read.biff.BiffException: Unable to recognize OLE stream
jxl.read.biff.BiffException: Unable to recognize OLE stream
at jxl.read.biff.CompoundFile.<init>(CompoundFile.jav a:116)
at jxl.read.biff.File.<init>(File.java:127)
at jxl.Workbook.getWorkbook(Workbook.java:268)
at jxl.Workbook.getWorkbook(Workbook.java:253)
at com.ramco.rvw.pl.ExcelImport.main(ExcelImport.java :24)
Have a look at Apache POI - Java API To Access Microsoft Format Files
// Json
hi i have lookined into that API but could not find the solution.
can u please provide the sample code?
Thanks
Search for "XSSF and SAX (Event API)" on The New Halloween Document
// Json
Hi,
Thanks,
I have tried but getting this error
org.apache.poi.openxml4j.exceptions.InvalidOperati onException: Can't open the specified file: 'D:\grdview.xls'
can u pls help me?
It's been a very long time since I used POI. If I get a chance later I shall give it a go.
Could you attach an Office 2007 Excel file to this thread please which I can use for testing?
// Json
Thanks.
Sure. I have attached the file for ur reference.
I opened Office 2007 file and saved as 97 - 2003 xls format. it is working fine.
Here is my code:
import java.io.FileInputStream;
import jxl.Sheet;
import jxl.Workbook;
//import org.junit.AfterClass;
//import org.junit.BeforeClass;
//import org.junit.Test;
import org.openqa.selenium.server.RemoteControlConfigurat ion;
import org.openqa.selenium.server.SeleniumServer;
import com.thoughtworks.selenium.*;
public class DatadrivenJUnit extends SeleneseTestCase{
public Selenium selenium;
public SeleniumServer seleniumserver;
//@BeforeClass
public void setUp() throws Exception {
RemoteControlConfiguration rc = new RemoteControlConfiguration();
//rc.setSingleWindow(true);
seleniumserver = new SeleniumServer(rc);
selenium = new DefaultSelenium("localhost", 4444, "*iexplore", "http://");
seleniumserver.start();
selenium.start();
}
//@Test
public void testDatadrivenJUnit() throws Exception
{
FileInputStream fi=new FileInputStream("C:\\Selenium\\DDT\\search1.xls");
Workbook w=Workbook.getWorkbook(fi);
Sheet s=w.getSheet(0);
selenium.open("http://www.google.com");
selenium.windowMaximize();
for (int i = 1; i < s.getRows(); i++)
{ //Read data from excel sheet
selenium.type("name=q",s.getCell(0,i).getContents( ));
selenium.click("btnG");
Thread.sleep(1000); } }
//@AfterClass
public void tearDown() throws InterruptedException{
selenium.stop();
seleniumserver.stop();
}
}
Please don't resurrect a 3 year old post. If you have a question, then please start a new thread with all code, errors, and a specific question. Thread locked