{"record":{"id":"0e4d204278a9b5d0","repo":"qax-os/excelize","slug":"errunsupportedpivottableshowvaluesastype","errorCode":"ErrUnsupportedPivotTableShowValuesAsType","errorMessage":"unsupported pivot table show values as type","messagePattern":"unsupported pivot table show values as type","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"errors.go","lineNumber":203,"sourceCode":"\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\")\n\t// ErrWorkbookFileFormat defined the error message on receive an\n\t// unsupported workbook file format.\n\tErrWorkbookFileFormat = errors.New(\"unsupported workbook file format\")\n\t// ErrWorkbookPassword defined the error message on receiving the incorrect\n\t// workbook password.\n\tErrWorkbookPassword = errors.New(\"the supplied open workbook password is not correct\")\n)\n\n// ErrSheetNotExist defined an error of sheet that does not exist.\ntype ErrSheetNotExist struct {\n\tSheetName string\n}\n\n// Error returns the error message on receiving the non existing sheet name.\nfunc (err ErrSheetNotExist) Error() string {\n\treturn fmt.Sprintf(\"sheet %s does not exist\", err.SheetName)\n}\n","sourceCodeStart":185,"sourceCodeEnd":221,"githubUrl":"https://github.com/qax-os/excelize/blob/f2483381fbfbe432a6baa98d48a1c277183f3285/errors.go#L185-L221","documentation":"ErrUnsupportedPivotTableShowValuesAsType indicates that the ShowDataAs value in PivotTableOptions is not a recognized \"show values as\" type. setPivotTableShowValuesAs checks the value against pivotTableShowValuesAsMap and returns this error on miss (pivotTable.go:907).","triggerScenarios":"Calling f.AddPivotTable(&PivotTableOptions{... ShowDataAs: \"invalidType\" ...}) with a string not in the supported map (e.g. not \"normal\", \"percent\", etc.).","commonSituations":"Typo in ShowDataAs; copying values from Excel UI naming that differs from excelize's accepted constants.","solutions":["Use one of the documented ShowDataAs constants/strings accepted by excelize","Omit ShowDataAs (defaults to \"normal\")","Check pivotTableShowValuesAsMap in pivotTable.go for valid values"],"exampleFix":"// before\nopt.ShowDataAs = \"PercentOfTotal\" // not a valid token\n// after\nopt.ShowDataAs = \"percent\" // valid value from pivotTableShowValuesAsMap\nf.AddPivotTable(opt)","handlingStrategy":"validation","validationCode":"valid := map[string]bool{\"normal\": true, \"difference\": true, \"percent\": true, /* see pivotTableShowValuesAsMap */}\nif opt.ShowDataAs != \"\" && !valid[opt.ShowDataAs] {\n\treturn fmt.Errorf(\"invalid ShowDataAs: %s\", opt.ShowDataAs)\n}","typeGuard":null,"tryCatchPattern":"err := f.AddPivotTable(opt)\nif errors.Is(err, excelize.ErrUnsupportedPivotTableShowValuesAsType) {\n\treturn fmt.Errorf(\"ShowDataAs %q not supported; check docs\", opt.ShowDataAs)\n}","preventionTips":["Use the exported ShowDataAs constants from excelize instead of raw strings","Verify values against pivotTableShowValuesAsMap when in doubt","Add unit tests for pivot options"],"tags":["go","excelize","pivot-table","validation"],"backgroundTag":"invalid-enum-value","analyzedSha":"f2483381fbfbe432a6baa98d48a1c277183f3285","analyzedAt":"2026-09-02T01:26:19.299Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}