{"record":{"id":"78e4212df6e96a5c","repo":"qax-os/excelize","slug":"errunprotectsheet","errorCode":"ErrUnprotectSheet","errorMessage":"worksheet has set no protect","messagePattern":"worksheet has set no protect","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"errors.go","lineNumber":182,"sourceCode":"\tErrSparklineRange = errors.New(\"parameter 'Range' is required\")\n\t// ErrSparklineStyle defined the error message on receive the invalid\n\t// sparkline Style parameters.\n\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\")","sourceCodeStart":164,"sourceCodeEnd":200,"githubUrl":"https://github.com/qax-os/excelize/blob/f2483381fbfbe432a6baa98d48a1c277183f3285/errors.go#L164-L200","documentation":"Sentinel error ErrUnprotectSheet returned by UnprotectSheet when the target worksheet has no SheetProtection element set, so there is nothing to remove; indicates removal of protection was attempted on an unprotected sheet.","triggerScenarios":"Calling f.UnprotectSheet(sheetName, ...) (with or without password) when the sheet's SheetProtection element is absent or not enabled.","commonSituations":"Calling UnprotectSheet unconditionally without checking whether the sheet was protected; scripts processing mixed protected/unprotected sheets.","solutions":["Check ws.SheetProtection is set before calling UnprotectSheet, or ignore this error","Remove the UnprotectSheet call for unprotected sheets"],"exampleFix":"// before\nerr := f.UnprotectSheet(\"Sheet1\", \"pw\")\n// after\nws, _ := f.GetSheetProtection... // check protection first\nif err != nil && err != ErrUnprotectSheet { return err }","handlingStrategy":"try-catch","validationCode":"ws, err := f.GetSheetProtection... // or inspect f.WorkBook.Sheet metadata\n// only call UnprotectSheet when protection options are present","typeGuard":null,"tryCatchPattern":"if err := f.UnprotectSheet(\"Sheet1\", \"pw\"); err != nil && !errors.Is(err, excelize.ErrUnprotectSheet) {\n\treturn err\n}","preventionTips":["Track which sheets you protected in your application state","Treat ErrUnprotectSheet as a no-op warning in batch unprotect scripts"],"tags":["go","excelize","sheet-protection"],"backgroundTag":"sheet-not-protected","analyzedSha":"f2483381fbfbe432a6baa98d48a1c277183f3285","analyzedAt":"2026-09-02T01:26:19.299Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}