aspose file tools*
The moose likes JDBC and the fly likes Parsing Excel-2007-Format (xlsx) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Parsing Excel-2007-Format (xlsx)" Watch "Parsing Excel-2007-Format (xlsx)" New topic
Author

Parsing Excel-2007-Format (xlsx)

Mark Kafe
Ranch Hand

Joined: Jun 23, 2008
Posts: 60

Hi
I want to read data from Excel-2007-Format (xlsx) and store it in Data base, i try to use JXL but it not support this Excel-2007 and i also try to read it through Apachi POI API but i not find any proper solutions.


please any body have any idea about this help me








Eduardo Bueno
Ranch Hand

Joined: Jun 04, 2009
Posts: 155
What did you go through in Apache POI?

You can read a .xlsx file with POI 3.5+ using a WorkbookFactory.

http://poi.apache.org/spreadsheet/quick-guide.html#ReadWriteWorkbook
Mark Kafe
Ranch Hand

Joined: Jun 23, 2008
Posts: 60

which jar i used for this? currently i used POI = poi-ooxml-3.5-beta5.jar and poi-scratchpad-3.2-FINAL file
Mark Kafe
Ranch Hand

Joined: Jun 23, 2008
Posts: 60

i try to this code but it gives errors





java.lang.NoClassDefFoundError: org/apache/poi/ss/usermodel/Workbook
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
Exception in thread "main"
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39578
    
  27
which jar i used for this? currently i used POI = poi-ooxml-3.5-beta5.jar and poi-scratchpad-3.2-FINAL file

Don't use any of the 3.2 files; use the 3.5 files.


Ping & DNS - updated with new look and Ping home screen widget
Mark Kafe
Ranch Hand

Joined: Jun 23, 2008
Posts: 60

thnx Ulf Dittmer,
i change the All jars to 3.5beta5 but same error again.............
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39578
    
  27
Maybe there's a typo somewhere? I found that class in a file called poi-3.5-beta6-20090622.jar (but I *think* it was there even in 3.5 beta 5).

Which command, exactly, are you using to execute the code?
Mark Kafe
Ranch Hand

Joined: Jun 23, 2008
Posts: 60

i run it from myEclipse through main method
Mark Kafe
Ranch Hand

Joined: Jun 23, 2008
Posts: 60

can you tell me please which jars working fine for this purpose because i try all 3.5 beta5 but i could not got my result,
i m very thank to you if i do this with yous helps
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39578
    
  27
Well, I could download 3.5 beta 5 to see if the class is in there, but since it's your problem I'll let you download 3.5 beta 6 instead; that has the class for sure. If you then still experience the problem it's an issue of setting the classpath incorrectly.
Mark Kafe
Ranch Hand

Joined: Jun 23, 2008
Posts: 60

Ulf Dittmer,

i use these files poi-ooxml-3.5-beta6-20090522,poi-scratchpad-3.5-beta6-20090222,poi-contrib-3.5-beta6-20090222

in this package org.apache.poi.ss.usermodel only one class show WorkbookFactory; Workbook class not in this package

but still problem error is

java.lang.NoClassDefFoundError: org/apache/poi/ss/usermodel/Workbook
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
Exception in thread "main"
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39578
    
  27
You're missing the file I mentioned above, which is called poi-3.5-beta6-20090622.jar. (You most likely don't need the contrib file, but it doesn't hurt to have it in the classpath.)
Mark Kafe
Ranch Hand

Joined: Jun 23, 2008
Posts: 60

thnx Ulf Dittmer
now its working when i add this file
 
Consider Paul's rocket mass heater.
 
subject: Parsing Excel-2007-Format (xlsx)
 
Similar Threads
read an excel file in .xlsx format
How to read xlsx file from local java file
Reduce Excel XML file size
Hash value are not same
Excel conversion tool.