Not able to read the data from 'xlsx' format

70 views
Skip to first unread message

Harish Dhage

unread,
Feb 10, 2015, 12:33:03 PM2/10/15
to seleniu...@googlegroups.com
Hi Guys,

I tried to read the data from excel sheet which was saved as '.xlsx' format then NullPointerExcetion or java.lang.NoClassDefFoundError: org/apache/xmlbeans/XmlOptions error I am getting.

But if I change the format of file to '.xls' then able to read. Please let me so that how we can able to read data from xlsx file.

public static String getCellValue(String sheetName, int rowNum, int cellNum) throws InvalidFormatException, IOException{
String cellValue;
System.out.println("getCellValue");
System.out.println("a");
FileInputStream fis = new FileInputStream(xlsPath);
System.out.println("b");
Workbook wb = WorkbookFactory.create(fis);
System.out.println("c");
cellValue = wb.getSheet(sheetName).getRow(rowNum).getCell(cellNum).getStringCellValue();
System.out.println("d");
System.out.println(cellValue);
//cellValue="";
//System.out.println("error "+e.getMessage());
return cellValue;
}



krishnan.ma...@gmail.com

unread,
Feb 10, 2015, 12:35:21 PM2/10/15
to seleniu...@googlegroups.com
This doesn't have anything to do with selenium or webdriver. 

Please help keep this forum relevant by posting queries that are only related to selenium or webdriver. 


- Krishnan

This message may include free added typos, which you may use for your entertainment.
Courtesy : my SmartPhone!
_____________________________
From:Harish Dhage
Subject:[selenium-users] Not able to read the data from 'xlsx' format
To:seleniu...@googlegroups.com
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/4fe5e0c2-b799-4f91-8869-55cac8dc8a37%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Bhanu Prasad Sangita

unread,
Feb 11, 2015, 12:23:33 AM2/11/15
to seleniu...@googlegroups.com
Hi 
 Its POI(POI is the apache's support for reading excel) issue. If you are using .xls use HSSF package and if using .xlsx use XSSF package.Once check by chnanging packages which you are importing.

Hope it helps you.

Thank You.

The information in this message may be proprietary and/or confidential, and protected from disclosure. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify ATMECS and delete it from your computer.

Harish Dhage

unread,
Feb 11, 2015, 10:03:28 PM2/11/15
to seleniu...@googlegroups.com
Thanks Bhanu :) I will try out.

--
You received this message because you are subscribed to a topic in the Google Groups "Selenium Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/selenium-users/tfpJv7vrovk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to selenium-user...@googlegroups.com.

To post to this group, send email to seleniu...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Thanks & Regards
Harish S Dhage
+91 9986146166

Bhanu Prasad Sangita

unread,
Feb 12, 2015, 4:48:30 AM2/12/15
to seleniu...@googlegroups.com
Hi 
If you are  using JXL API its does not support .xlsx format .It only supports .xls format try with apache POI it will help your requirement. 

Hope this helps you.

Thank You 


On Tuesday, February 10, 2015 at 11:03:03 PM UTC+5:30, Harish Dhage wrote:

Jonathan Taylor

unread,
Feb 13, 2015, 3:43:43 PM2/13/15
to seleniu...@googlegroups.com
Are you using Office 64 - Bit and possibly Visual Studio or any other IDE at 32-Bit?  If so you will have a hard time making things work.  Not sure if that's the problem though.  
Reply all
Reply to author
Forward
0 new messages