Proteggere e Difendere il Foglio di Lavoro

Proteggere e proteggere il foglio di lavoro in MS Excel

proteggere e proteggere il foglio di lavoro

  1. Fare clic su Revisione > Proteggi foglio di lavoro.
  2. Inserire una password nella casella di Password.
  3. Selezionare le opzioni consenti.
  4. Selezionare OK, reinserire la password per confermarla e quindi selezionare di nuovo OK.

Proteggere il foglio di lavoro usando Aspose.Cell per Python

È sufficiente utilizzare le seguenti linee di codice per implementare la protezione della struttura della cartella di lavoro dei file di 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')

Sblocca Foglio di Lavoro Usando Aspose.Cell per Python

Sbloccare un foglio di lavoro è facile con l’API Aspose.Cells. Se il foglio di lavoro è protetto da password, è necessaria una password corretta.

#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")