import java.io.File;
import java.io.IOException;
import jxl.Workbook;
import jxl.read.biff.BiffException;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
import jxl.write.WriteException;
public class JExcelApiTest
{
public static void main(String[] args)
{
try
{
Workbook workbook = Workbook.
getWorkbook(new File("/path/to/protected.xls"));
WritableWorkbook copy = Workbook.
createWorkbook(new File("/path/to/unprotected.xls"), workbook);
WritableSheet[] sheets = copy.getSheets();
for (WritableSheet sheet : sheets)
{
sheet.getSettings().setProtected(false);
}
copy.write();
copy.close();
}
catch (BiffException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
catch (WriteException e)
{
e.printStackTrace();
}
}
}
Hope this helps
goodmorning,
I'm facing the problem to read an excel file password protected using java excel api.
I KNOW THE RIGHT PASSWORD but I'm not able to use it while opening the file.
The instruction you suggested:
workbook = Workbook.getWorkbook(new File(sAbsPathExcel));
GIVES the exception.
Does anyone know how to read an excel file password protected if I KNOW THE PASSWORD with java code?
Thanks