This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Java in General and the fly likes Reading password protected Excel spreadsheet Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Reading password protected Excel spreadsheet" Watch "Reading password protected Excel spreadsheet" New topic
Author

Reading password protected Excel spreadsheet

Denis Mir
Greenhorn

Joined: Jul 20, 2009
Posts: 12
Hello,

I have an excel spreadsheet that was designed to be a form where you can plug-in some
values and it will calculate costs based on the formula, it takes about 30 different parameters.
I can open this form, enter values and get a result without entering password (both manually
and in Java). I don't have access to the formula.

At the moment I'm using e-Spreadsheet from Actuate. http://www.actuate.com/products/e-spreadsheet/

But the problem is that it's very slow. Opening the document takes 5.8 seconds and about
2.6 seconds to read result from the bottom of the form. This is a 3.6 meg file, maybe that's
the reason?

I tried http://jexcelapi.sourceforge.net/ and http://poi.apache.org/. Both of these libraries
cannot handle password protected Excels. I wanted to try Weblogic JCom but I'm not sure
which DLL I need to access and how to use it (I used JCom before to access another DLL.)
I'm going to try OpenXLS http://sourceforge.net/projects/openxls/ next.

Do you guys know how to do this? How can I access this form without needing password?

Thank you,
Denis
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35241
    
    7
Welcome to JavaRanch.

While I'm not sure either way, there are indications that jExcelApi can be used to unlock Excel spreadsheets without having the password. That may be worth a try; let us know how you make out if you do.


Android appsImageJ pluginsJava web charts
Sergio Hernández
Greenhorn

Joined: Jul 30, 2009
Posts: 2
hi,
i'll be very glad if someone can give us a solution to this problem.
I have the password of the excel document, but dont know how to open it.

Thanks a lot,
Sergio.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35241
    
    7
Sergio, did you read (and act on) my previous post?
Sergio Hernández
Greenhorn

Joined: Jul 30, 2009
Posts: 2
yes, i read it and try,but dont works.
My excel document is sheet protected and book protected.

i've got the same exception (jxl.read.biff.PasswordException: The workbook is password protected) in the first line: Workbook workbook = Workbook.getWorkbook(new File("/path/to/protected.xls"));

Sergio.
Denis Mir
Greenhorn

Joined: Jul 20, 2009
Posts: 12
Hi guys,

Thank you for your replies. My problem was solved by testing my code on our server.
On my development machine my code would take about 7 seconds. On server it
is 0.7 seconds. So I don't have a problem anymore (can somebody recommend
good profiling tool? I want to figure out what exactly is going on.)

For the guys that have problem accessing password protected Excel sheets.
With e-Spreadsheet from Actuate. http://www.actuate.com/products/e-spreadsheet/
I don't have to enter the password. I can open the spreadsheet that I'm working with,
enter values and get results just by opening it in Excel. I'm not sure how e-Spreadsheet does
it but I can set cells that I need for calculation and I can read the results from result cells.

Denis
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Reading password protected Excel spreadsheet
 
Similar Threads
Database Design
using ms excel as a database
Window Problem
read in a xml file
Compile Excel to Java