This week's book giveaway is in the Java in General forum.
We're giving away four copies of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 and have ishori Sharan & Adam L Davis on-line!
See this thread for details.
Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

reading password protected excel sheet

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to read a password protected excel sheet using apache POI.The code works fine with any other excel sheet.However when I am trying to read the protected sheet i am getting the following exception

java.lang.NoSuchMethodError: java.lang.RuntimeException: method <init>(Ljava/lang/String;Ljava/lang/Throwable;)V not found
at org.apache.poi.hssf.record.RecordFormatException.<init>(RecordFormatException.java:36)
at org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.java:208)
at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:126)
at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:246)
at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:169)
at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:151)

the java code I am using is



It is throwing an exception at the line HSSFWorkbook wb = new HSSFWorkbook(fileSystem);

Any help is greatly appreciated
 
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to JR

You're not supposed to read the password protected excel file. Please use following method to check whether its protected or not.
http://poi.apache.org/apidocs/org/apache/poi/hssf/usermodel/HSSFWorkbook.html#isWriteProtected%28%29
 
Rancher
Posts: 43027
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It sounds as if you may be using jar files from different POI versions together. Make sure that all the files you have are from the same POI version.
 
sagarika kar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey ...i m using all files from poi 3.0 jar.and only the first two rows of the workbook are password protected...so i should be able to modify data inthe other rows...but i m getting this exception
Even if i m using the jexcel api i m getting exception as

the workbook is password protected
is their any way out??
 
Ulf Dittmer
Rancher
Posts: 43027
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
POI 3.0 is rather old; try a newer version such as 3.6.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic