sheet1.protectSheet("xxxx");
Actually I tried the above code, it is protecting the sheet from editing, but while I enable editing it does not ask for password, how to protect with password?
Read the Apache POI - Encryption support paragraph XML-based formats - Encryption. It comes with a source code example. See http://poi.apache.org/encryption.html