{"record":{"id":"d680a55b360936cc","repo":"qax-os/excelize","slug":"errsheetnameblank","errorCode":"ErrSheetNameBlank","errorMessage":"the sheet name can not be blank","messagePattern":"the sheet name can not be blank","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"errors.go","lineNumber":146,"sourceCode":"\t// length.\n\tErrPasswordLengthInvalid = errors.New(\"password length invalid\")\n\t// ErrPivotTableShowValuesAsBaseField defined the error message on enable\n\t// this kind of \"show values as\" type requires a base field.\n\tErrPivotTableShowValuesAsBaseField = errors.New(\"this kind of show values as type requires a base field\")\n\t// ErrPivotTableShowValuesAsBaseItem defined the error message on enable\n\t// this kind of \"show values as\" type and base field requires a base item.\n\tErrPivotTableShowValuesAsBaseItem = errors.New(\"this kind of show values as type and base field requires a base item\")\n\t// ErrPivotTableClassicLayout defined the error message on enable\n\t// ClassicLayout and CompactData in the same time.\n\tErrPivotTableClassicLayout = errors.New(\"cannot enable ClassicLayout and CompactData in the same time\")\n\t// ErrSave defined the error message for saving file.\n\tErrSave = errors.New(\"no path defined for file, consider File.WriteTo or File.Write\")\n\t// ErrSheetIdx defined the error message on receive the invalid worksheet\n\t// index.\n\tErrSheetIdx = errors.New(\"invalid worksheet index\")\n\t// ErrSheetNameBlank defined the error message on receive the blank sheet\n\t// name.\n\tErrSheetNameBlank = errors.New(\"the sheet name can not be blank\")\n\t// ErrSheetNameInvalid defined the error message on receive the sheet name\n\t// contains invalid characters.\n\tErrSheetNameInvalid = errors.New(\"the sheet can not contain any of the characters :\\\\/?*[or]\")\n\t// ErrSheetNameLength defined the error message on receiving the sheet\n\t// name length exceeds the limit.\n\tErrSheetNameLength = fmt.Errorf(\"the sheet name length exceeds the %d characters limit\", MaxSheetNameLength)\n\t// ErrSheetNameSingleQuote defined the error message on the first or last\n\t// character of the sheet name was a single quote.\n\tErrSheetNameSingleQuote = errors.New(\"the first or last character of the sheet name can not be a single quote\")\n\t// ErrSparkline defined the error message on receive the invalid sparkline\n\t// parameters.\n\tErrSparkline = errors.New(\"must have the same number of 'Location' and 'Range' parameters\")\n\t// ErrSparklineLocation defined the error message on missing Location\n\t// parameters\n\tErrSparklineLocation = errors.New(\"parameter 'Location' is required\")\n\t// ErrSparklineRange defined the error message on missing sparkline Range\n\t// parameters\n\tErrSparklineRange = errors.New(\"parameter 'Range' is required\")","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/qax-os/excelize/blob/f2483381fbfbe432a6baa98d48a1c277183f3285/errors.go#L128-L164","documentation":"ErrSheetNameBlank is returned when a worksheet name is an empty string. checkSheetName (sheet.go:1514) rejects blank names because Excel requires every worksheet to have a non-empty name, and operations like copy or rename would produce a corrupt workbook.","triggerScenarios":"Calling f.copySheet(-1, -2) with a source sheet index that resolves to no valid sheet name, or any API (CopySheet, rename helpers, etc.) that passes \"\" through checkSheetName before operating.","commonSituations":"Passing an out-of-range sheet index whose name lookup yields an empty string; building sheet names from configuration or user input that was never set; forgetting to initialize a name variable before calling sheet APIs.","solutions":["Check the sheet index/name before the call; use f.GetSheetName(index) to confirm the source sheet exists","Ensure the sheet name string is non-empty (e.g. validate or default to \"Sheet1\")","If copying, pass a valid source and target index of existing/new sheets"],"exampleFix":"// before\nerr := f.CopySheet(-1, -2)\n// after\nname := f.GetSheetName(srcIdx)\nif name == \"\" {\n    return fmt.Errorf(\"source sheet %d not found\", srcIdx)\n}\nerr := f.CopySheet(srcIdx, targetIdx)","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":["go","excelize","sheet-name","validation"],"backgroundTag":"blank-sheet-name","analyzedSha":"f2483381fbfbe432a6baa98d48a1c277183f3285","analyzedAt":"2026-09-02T01:26:19.299Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}