• 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:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

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: 43081
77
  • 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: 43081
77
  • 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.
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic