{"record":{"id":"60cd002e305b51f5","repo":"qax-os/excelize","slug":"errunprotectsheetpassword","errorCode":"ErrUnprotectSheetPassword","errorMessage":"worksheet protect password not match","messagePattern":"worksheet protect password not match","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"errors.go","lineNumber":185,"sourceCode":"\tErrSparklineStyle = errors.New(\"parameter 'Style' value must be an integer from 0 to 35\")\n\t// ErrSparklineType defined the error message on receive the invalid\n\t// sparkline Type parameters.\n\tErrSparklineType = errors.New(\"parameter 'Type' value must be one of 'line', 'column' or 'win_loss'\")\n\t// ErrTotalSheetHyperlinks defined the error message on hyperlinks count\n\t// overflow.\n\tErrTotalSheetHyperlinks = errors.New(\"over maximum limit hyperlinks in a worksheet\")\n\t// ErrTransparency defined the error message for receiving a transparency\n\t// value exceeds limit.\n\tErrTransparency = errors.New(\"transparency value must be an integer from 0 to 100\")\n\t// ErrUnknownEncryptMechanism defined the error message on unsupported\n\t// encryption mechanism.\n\tErrUnknownEncryptMechanism = errors.New(\"unknown encryption mechanism\")\n\t// ErrUnprotectSheet defined the error message on worksheet has set no\n\t// protection.\n\tErrUnprotectSheet = errors.New(\"worksheet has set no protect\")\n\t// ErrUnprotectSheetPassword defined the error message on remove sheet\n\t// protection with password verification failed.\n\tErrUnprotectSheetPassword = errors.New(\"worksheet protect password not match\")\n\t// ErrUnprotectWorkbook defined the error message on workbook has set no\n\t// protection.\n\tErrUnprotectWorkbook = errors.New(\"workbook has set no protect\")\n\t// ErrUnprotectWorkbookPassword defined the error message on remove workbook\n\t// protection with password verification failed.\n\tErrUnprotectWorkbookPassword = errors.New(\"workbook protect password not match\")\n\t// ErrUnsupportedEncryptMechanism defined the error message on unsupported\n\t// encryption mechanism.\n\tErrUnsupportedEncryptMechanism = errors.New(\"unsupported encryption mechanism\")\n\t// ErrUnsupportedHashAlgorithm defined the error message on unsupported\n\t// hash algorithm.\n\tErrUnsupportedHashAlgorithm = errors.New(\"unsupported hash algorithm\")\n\t// ErrUnsupportedNumberFormat defined the error message on unsupported\n\t// number format expression.\n\tErrUnsupportedNumberFormat = errors.New(\"unsupported number format token\")\n\t// ErrUnsupportedPivotTableShowValuesAsType defined the error message on\n\t// receiving the unsupported pivot table \"show values as\" type.\n\tErrUnsupportedPivotTableShowValuesAsType = errors.New(\"unsupported pivot table show values as type\")","sourceCodeStart":167,"sourceCodeEnd":203,"githubUrl":"https://github.com/qax-os/excelize/blob/f2483381fbfbe432a6baa98d48a1c277183f3285/errors.go#L167-L203","documentation":"ErrUnprotectSheetPassword indicates that the password supplied to UnprotectSheet failed hash verification against the stored sheet protection password. The library throws it when the computed hash does not match WorkbookHashValue/sheet hash stored in the sheet protection settings.","triggerScenarios":"Calling f.UnprotectSheet(sheetName, \"wrongPassword\") on a sheet protected with a password; hash comparison in UnprotectSheet fails.","commonSituations":"Typo in the password; user changed the protection password; password was set by another tool with a different algorithm variant.","solutions":["Supply the correct password that was used in ProtectSheet","If the password is lost, clear protection by editing the XML or re-creating the sheet","Call UnprotectSheet without a password only if no password was set"],"exampleFix":"// before\nerr := f.UnprotectSheet(\"Sheet1\", \"wrongPassword\")\n// after\nerr := f.UnprotectSheet(\"Sheet1\", \"password\") // actual protection password","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := f.UnprotectSheet(\"Sheet1\", pw); err != nil {\n\tif errors.Is(err, excelize.ErrUnprotectSheetPassword) {\n\t\treturn fmt.Errorf(\"incorrect sheet password\")\n\t}\n\treturn err\n}","preventionTips":["Store protection passwords securely alongside the file metadata","Prompt the user for the password rather than hardcoding","Verify the password with ProtectSheet's own round-trip in tests"],"tags":["go","excelize","sheet-protection","password"],"backgroundTag":"incorrect-password","analyzedSha":"f2483381fbfbe432a6baa98d48a1c277183f3285","analyzedAt":"2026-09-02T01:26:19.299Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}