Hoja de trabajo de protección y desprotección

Proteger y desproteger la hoja de trabajo en MS Excel

![hoja de trabajo para proteger y desproteger] (hoja de trabajo para proteger y desproteger.png)

  1. Hacer clicRevisar > Proteger hoja de trabajo.
  2. Introduzca una contraseña enel cuadro de contraseña.
  3. Seleccionepermitir opciones
  4. SeleccioneDE ACUERDO , vuelva a ingresar la contraseña para confirmarla y luego seleccioneDE ACUERDO de nuevo.

Proteger hoja de trabajo usando Aspose.Cell for Python

Solo necesita las siguientes líneas simples de código para implementar la protección de la estructura del libro de trabajo de los archivos de Excel.

#Create a new file.
workbook = Workbook()
#Gets the first worksheet.
sheet = workbook.getWorksheets().get(0)
#Protect contents of the worksheet.
sheet.protect(ProtectionType.CONTENTS)
#Protect worksheet with password.
sheet.getProtection().setPassword('test')
#Save as Excel file.
workbook.save('Book1.xlsx')

Desproteger hoja de trabajo usando Aspose.Cell for Python

Desproteger la hoja de trabajo es fácil con Aspose.Cells API. Si la hoja de trabajo está protegida con contraseña, se requiere una contraseña correcta.

#Create a new file.
workbook = Workbook("Book1.xlsx")
#Gets the first worksheet.
sheet = workbook.getWorksheets().get(0)
#Protect contents of the worksheet.
sheet.unprotect("password")
#Save Excel file.
workbook.save("Book1.xlsx")