removeProtection

removeProtection

PREMIUM BASIC / ADVANCED

Removes the password protection from an Excel spreadsheet.

Description
public removeProtection($source, $target, $options = array())

This method allows you to remove the protection from a password protected Excel spreadsheet.

Parameters

source

Path to the password protected Excel spreadsheet.

target

Path where you want to save the resulting unprotected spreadsheet.

options

The possible keys and values are:

Key Type Description
removeSheetsProtection bool If true remove sheets protection. Default as true.
removeWorksheetProtection bool If true remove worksheet protection. Default as true.
sheetsSelection array Sheets to remove protectition: 'names' or 'positions'. If not set, all sheet protections are removed.
Exceptions

The source file doesn't exist.

Code samples

Example #1

Example #2

Release notes
  • phpxlsx 1.0:
    • new method.